Edit Image

Plugin ID: pml_edit_image

Description

The Edit Image tool allows you to modify and enhance existing images using AI-powered natural language prompts. Simply upload your image and describe the changes you want to make, and the AI will intelligently apply those modifications while preserving the original image's context and quality.

Cost Information

  • Cost: 4 credits

  • PixelML Cost: Based on the selected model pricing

Input Parameters

Parameter
Type
Required
Default
Description

model

string

No

"Gemini 2.5 Flash Image Preview"

The AI model to use for image editing. Options: Gemini 2.5 Flash Image Preview, Gemini 2.0 Flash Exp Image

prompt

string

Yes

-

The editing instructions describing what changes you want to make to the image. Example: "Add a sunset background and make the sky orange"

images

array

Yes

-

Array of image URLs to edit. Supports JPG and PNG formats. Multiple images can be processed together.

temperature

number

No

0.9

Controls randomness in the editing process. Lower values (0.0-0.3) = more consistent, higher values (0.7-1.0) = more creative. Range: 0.0-1.0

max_tokens

integer

No

2048

Maximum number of tokens for the model's response. Higher values allow for more detailed descriptions of changes made.

top_p

number

No

1.0

Controls diversity of editing approaches using nucleus sampling. Lower values focus on most likely edits.

Output

Field
Type
Description

content

any

The edited image result or description of changes made, depending on the model's response format

raw_content

string

Raw content returned by the model, containing detailed information about the editing process

How It Works

  1. Image Analysis: The AI analyzes the uploaded image(s) to understand the content, composition, and style

  2. Prompt Understanding: The system interprets your editing instructions and identifies specific modifications to make

  3. Context Preservation: The AI maintains the original image's context while applying the requested changes

  4. Intelligent Editing: Advanced algorithms apply modifications while preserving image quality and coherence

  5. Response Generation: The system provides the edited result along with detailed information about changes made

Use Cases

  • Photo Enhancement: Improve lighting, color balance, and overall image quality

  • Background Modification: Change or remove backgrounds, add new environments

  • Object Manipulation: Add, remove, or modify objects within images

  • Style Transfer: Apply artistic styles or visual effects to existing photos

  • Color Correction: Adjust colors, saturation, and tone mapping

  • Composition Changes: Reframe, crop, or restructure image layouts

  • Creative Editing: Apply artistic effects and creative transformations

Example Usage

Background Replacement

Model: Gemini 2.5 Flash Image Preview
Prompt: "Replace the background with a beautiful mountain landscape at sunset"
Images: ["https://example.com/portrait.jpg"]
Temperature: 0.5

Color Enhancement

Model: Gemini 2.0 Flash Exp Image
Prompt: "Enhance the colors to make them more vibrant and increase the contrast"
Images: ["https://example.com/photo.jpg"]
Temperature: 0.3
Max Tokens: 1024

Object Addition

Model: Gemini 2.5 Flash Image Preview
Prompt: "Add flying birds in the sky and some clouds to make the scene more dynamic"
Images: ["https://example.com/landscape.jpg"]
Temperature: 0.7
Top P: 0.9

Model Comparison

Model
Strengths
Best For

Gemini 2.5 Flash Image Preview

Fast processing, good quality edits

Quick edits, iterative workflows

Gemini 2.0 Flash Exp Image

Experimental features, advanced edits

Complex modifications, creative work

Temperature Guide

Temperature
Use Case
Behavior

0.0-0.3

Precise edits, corrections

Consistent, predictable modifications

0.4-0.6

Balanced editing

Good mix of accuracy and creative interpretation

0.7-1.0

Creative transformations

More artistic and varied editing approaches

Tips for Best Results

  1. Be Specific: Provide clear, detailed instructions about the desired changes

  2. Use High-Quality Images: Start with good resolution images for better editing results

  3. Describe Context: Mention the style, mood, or atmosphere you want to achieve

  4. Adjust Temperature: Use lower values for precise edits, higher for creative changes

  5. Support Multiple Formats: Ensure images are in JPG or PNG format

  6. Batch Processing: Upload multiple images for consistent editing across a set

Prompt Engineering for Image Editing

Effective Editing Prompts

Structure: [Action] + [Target] + [Style/Quality] + [Context]
Examples:
- "Remove the person in the background and blur the distant objects"
- "Change the lighting to golden hour with warm, soft shadows"
- "Add realistic rain effects while maintaining the original mood"

Specific vs. General Instructions

  • Specific: "Make the sky a deep blue color and add white puffy clouds"

  • General: "Improve the sky appearance"

  • Best Practice: Combine both for optimal results

Limitations

  • Supported Formats: Only JPG and PNG image formats are accepted

  • Model Availability: Available models depend on your PixelML subscription

  • Image Size: Large images may require more processing time

  • Complex Edits: Some advanced modifications may require multiple iterations

  • Quality Dependency: Results depend on the quality and resolution of input images

  • Content Restrictions: Some editing requests may be limited by content policies

Privacy & Compliance

  • Uploaded images are processed securely and not stored permanently

  • Image editing respects privacy and does not create inappropriate content

  • Complies with Gemini AI content policies and usage guidelines

  • Users should ensure they have rights to edit and modify the uploaded images

  • Generated edits should not be used to create misleading or deceptive content

  • Respects intellectual property and avoids unauthorized modifications of copyrighted material

Error Handling

Common error scenarios:

  • Missing Required Fields: Returns error if prompt or images are not provided

  • Invalid Image Format: Returns error for unsupported file formats (only JPG/PNG accepted)

  • Image Upload Failed: Returns error if images cannot be accessed or processed

  • Invalid Parameters: Returns error if temperature, max_tokens, or top_p are outside valid ranges

  • Model Unavailable: Returns error if selected model is temporarily unavailable

  • Content Policy Violation: Returns error if editing requests violate content guidelines

  • Processing Failed: Returns error if the AI cannot complete the requested modifications

Last updated

Was this helpful?