Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added support for image editing and upscaling for imagen3 #989

Merged
merged 5 commits into from
Oct 3, 2024

Conversation

pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented Oct 1, 2024

  const baseImg = fs.readFileSync('base.png', { encoding: 'base64' });
  const maskImg = fs.readFileSync('mask.png', { encoding: 'base64' });

  const response = await generate({
    model: imagen3,
    output: { format: 'media' },
    prompt: [
      { media: { url: `data:image/png;base64,${baseImg}` }},
      {
        media: { url: `data:image/png;base64,${maskImg}` },
        metadata: { type: 'mask' },
      },
      { text: 'replace the background with foo bar baz' },
    ],
    config: {
      editConfig: {
        editMode: 'outpainting',
      },
    },
  });

  return response.media();

@MichaelDoyle
Copy link
Member

See comments on #988.

@pavelgj
Copy link
Collaborator Author

pavelgj commented Oct 3, 2024

See comments on #988.

resolved

@pavelgj pavelgj requested a review from apascal07 October 3, 2024 14:20
docs/plugins/vertex-ai.md Outdated Show resolved Hide resolved
docs/plugins/vertex-ai.md Outdated Show resolved Hide resolved
@pavelgj pavelgj merged commit 231591b into main Oct 3, 2024
4 checks passed
@pavelgj pavelgj deleted the pj/imagen3editingMain branch October 3, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants