Runoob Tutorial ArchiveEnglish

AI Image Editing and Modification

AI Image Editing and Modification

Previously, we learned how to have AI generate images from scratch, but in actual use, there is a very common situation:The overall image is already very good, but there is a part that is not satisfactory.

For example, after finally generating an promotional illustration, the character, background, and lighting are all suitable, but there is a green plant in the bottom right corner.

If we regenerate the entire image, the character's face might change, the table's position might change, and the originally satisfactory picture will need to be adjusted again.

Actually, there is no need to be so complicated.

Now many AI image tools support editing based on the original image; we can directly tell the AI:Remove the flowerpot in the bottom right corner, and keep other areas as unchanged as possible.

This chapter will use this case study to learn how to use AI to perform local modifications on existing images, including removing unnecessary objects, repairing backgrounds, controlling the modification scope, and checking the editing results.


I. What is the difference between AI image editing and regeneration?

Text-to-Image, which was introduced earlier, is mainly about generating entirely new scenes based on text descriptions.

Image editing is different: we already have an image, and we want the AI to modify specific content based on the original image.

For example:

These tasks do not necessarily require regenerating the entire image.

Three common processing methods

Processing method Main function Applicable Scenarios
** Local Inpainting Specify an area for the AI to regenerate local content Remove clutter, modify local colors, repair backgrounds
** Full Image Editing Re-adjust larger areas based on the original image Change art style, adjust overall atmosphere
** Traditional Layer Editing Precisely adjust independent objects, text, and layers Modify poster text, Logo, and precise positions

This lesson only removes a potted plant in the bottom right corner, so prioritizeLocal Re-painting.

However, note that: AI local editing does not guarantee that pixels in other areas will remain completely unchanged. If you need to strictly protect the original image, you can composite the generated patched area back into the original image using layers or masks.


II. Understanding Local Re-painting, Masks, and Background Completion

Before starting the operation, first understand three common terms.

1. Inpainting

Inpainting is when the AI regenerates a specified area based on the surrounding content of the image.

For example, if there is a flowerpot in the bottom right corner of a desktop photo, and you remove the flowerpot, the desktop area that was covered by it does not exist in the picture.

The AI needs to infer and fill in a reasonable background based on the surrounding wood grain, color, lighting, and perspective.

This process is called inpainting.

2. Mask

A mask can be understood as a specified editing area.

In tools that support masks, we can use a brush to circle the flowerpot and greenery, allowing the AI to focus on this area.

Areas outside the mask are usually protected more strictly, but the specific effect depends on the editing tool. Some models may still alter surrounding details.

3. Background Completion

Deleting an object is not just erasing it to a blank space.

For example, after removing a flowerpot from the table, you also need to complete the desktop, wall, shadows, and textures behind it.

If these details are not handled well, blurry patches, repeated wood grain, or obvious patching marks will appear.

Concept Simple understanding Operations corresponding to this lesson
Local inpainting Regenerate a small area of the image Remove the flower pot and plants
Mask Specify the area allowed for editing Select the plant area in the bottom right corner
Background completion Fill in the obscured image Complete the wooden desktop and wall.

The focus of this lesson is to combine and use these three capabilities.


III. Practical Scenario: Remove the green plant in the bottom right corner of the promotional illustration.

Below is a promotional theme illustration that has already been generated.

The characters, laptop, desktop, desk lamp, and overall warm color style in the image all meet the requirements.

However, there is a green plant in the bottom right corner, and we want to remove it.

Prepare the original image.

Original illustration before AI image editing, with green plants and a white flowerpot to be removed in the bottom right corner.

The requirement for this modification is very clear:

Project Specific requirements
** Delete objects The white flowerpot and green plants in the bottom right corner
** Needs repair The desktop, wall, and shadows originally covered by the flowerpot
** Must be retained The person's face, hairstyle, clothing, posture, and expression
Other objects Computer, desk lamp, books, coffee cup, etc.
Overall style Original illustration style, warm tones, and natural light
Image size Maintain the aspect ratio of the original image, do not crop proactively

The entire editing process is as follows:

AI image editing workflow: upload original image, specify area, inpaint, compare results, and export image.

Note that this is not about redesigning an event poster, butOnly solve a local problem.


Four, Step 1: Upload the image and describe what needs to be modified

Open an AI tool that supports image editing, such as ChatGPT, and upload the original image in the conversation.

If the tool supports selecting areas directly on the image, first circle the pot and plant in the bottom right corner.

If there is no selection function, you can also describe the object's position, color, and shape in text.

First try a simple instruction

Example: The simplest object removal instruction

Please remove the green plant and white flowerpot in the bottom right corner of the image.

Naturally complete the desk and background that were originally obscured.

Keep other areas as much as possible.

If the image is simple, this instruction may be sufficient.

However, this illustration includes characters, desk items, and many details. If you want to minimize changes to other parts, you need to write the constraints more clearly.


V. Second Step: Local Editing with the Full Prompt

Below is a complete editing prompt written for the image in this lesson.

It mainly includes three parts:What to delete, how to complete after deletion, and what content cannot be modified.

Example: The complete prompt for removing the green plant in the bottom right corner.

Please perform local editing on the image I uploaded.

[Modification Target]

Remove the white flower pot and the green plant in it from the bottom right corner of the screen.

Including:

Green leaves

Green leaf

Pot body

Shadow where the pot touches the desk

[Background restoration]

After removing the plant and pot,

based on the surrounding wooden desk,

wall, color, and lighting,

naturally complete the obscured area.

Requirements:

Continuous wooden desktop texture.

Natural color transition on the wall.

Correct relationship between the desktop edge and perspective.

The repair area retains reasonable natural light and shadow.

No blurry or repeating textures.

[Content that must be retained]

The female figure in the center of the screen remains unchanged:

Face

Hairstyle

Clothing

Pose

Expression

Other objects remain unchanged:

Laptop

Desk lamp

Book

Coffee cup

Notebook

Bookshelf

Wall decoration picture

[Overall requirements]

Keep the original image's:

Composition

Aspect ratio

Illustration style

Warm tones

Lighting direction

Image details

Do not redesign the entire image.

[Restriction]

Only modify the area with the plant and its pot in the bottom right corner.

Keep other areas as consistent with the original image as possible.

Do not add any new objects.

Do not add text, borders, logos, or watermarks.

[Final Output]

Generate a complete modified image.

The pot and plants in the bottom right corner should completely disappear,

and the desktop should blend naturally with the background.

Do not output collages or before-and-after comparison images.

Compared to ordinary text-to-image generation, the biggest difference in this prompt is that it repeatedly clarifiesWhat existing content needs to be retained.

This is especially important for character illustrations, because when AI regenerates, it might unintentionally change facial features, hairstyles, or clothing details.


VI. Step 3: Use selection to improve local editing accuracy

If the current tool supports brush selection or masks, it is recommended to use them together.

Because the text description "the plant in the bottom right corner" is clear, but the model may not be able to accurately determine the pixel range that needs modification.

How to select the editing area

  1. Open the editing interface of the original image.
  2. Select the local edit or area selection tool.
  3. Use the brush to cover the green plants and white flower pots.
  4. Appropriately include the edges of the plants and the contact shadows that need to be repaired.
  5. Confirm that the person and other objects are not in the selection area.
  6. Enter the deletion and background completion requirements to start editing.

If the tool can set the transition range of the selection edge, you can appropriately retain a small amount of transition area to make the newly generated background blend more naturally with the original image.

How big should the selection area be

Selection area status Potential issues Suggestions
Too small Pot edges, leaves, or shadow residue Expand appropriately to fully cover the target object
Too large Desktop and surrounding objects are over-redrawn Shrink to the necessary range
Hard edges Noticeable seams in the patched area Use smooth transitions appropriately
Covering other subjects Characters or other objects are unintentionally modified Re-adjust the selection area

It should be noted that a smaller selection area is not always better. If plants have thin leaves or complex shadows, an overly small selection area can actually leave artifacts.

A more suitable method is to completely cover the object to be removed and adjust the patching range according to the complexity of the surrounding background.


VII. Step 4: Compare the before and after images

After generating the image, do not only look at whether the plants in the bottom right corner have disappeared.

You should also check if the parts that were already satisfactory have changed during the editing process.

Example image after editing

Example image after AI local editing, with the flowerpot and green plants removed from the bottom right corner.

You can open the before and after images side by side, focusing on the patched area in the bottom right corner.

The goal of this case is to remove unnecessary plants while preserving the character and overall visual style as much as possible.

Before and after comparison of AI image local editing: removing extraneous objects and filling in the background.

What issues to focus on checking

Check the project Through standard
** Object Removal Pots, leaves, and unreasonable residual shadows disappear
** Background Restoration Desktop textures, wall colors, and perspective relationships are natural
** Character Consistency Face, hairstyle, clothing, and pose have no obvious changes
** Other Objects Keep computers, desk lamps, books, etc. in their original positions
** Lighting and shadows Patch areas must match the surrounding lighting direction
** Edge details No obvious seams, smudging, or repeating textures
** Image dimensions Aspect ratio and overall composition must meet the requirements

If the image originally contained text, the text content must be checked character by character. Generative editing may change the originally correct text.

Zoom in to view the repair location

It is recommended to zoom the image to 100% for viewing.

Some repair issues cannot be seen in the thumbnail, such as a sudden interruption in the desktop wood grain, repeating patterns on the wall, or the original plant location turning into a blurry color block.

These issues can only be found after zooming in.


VIII. What to do if the first modification is not satisfactory and how to continue adjusting

If the plant has disappeared, but the desktop repair is not natural enough, you do not need to redesign the entire image.

You can have the AI continue processing the previously repaired area.

Situation 1: Blurry color blocks appear in the background

Example: Repairing blurry desktop texture

Please continue repairing the previously edited image.

Current issue:

A blurry patch appears in the original location of the flowerpot in the bottom right corner.

Please only modify this patched area.

Requirements:

Refer to the texture of the surrounding wooden desktop.

Maintain the original perspective direction of the desktop.

Allow wood grain and color to transition naturally.

Preserve natural light and shadow.

Do not re-add flower pots or plants.

Do not modify people or other objects.

Maintain the original composition and illustration style.

Scenario two: Accidental modification of the person's face

If you are only trying to remove a plant but find that the person's face has also changed, it is recommended to start editing from the original image.

Because continuing to generate on an already modified image may accumulate deviations.

Example: Relock the original character

The previous version's modification affected the character's face.

Please use the original image uploaded initially,

and do not use a modified image as a base.

This time, only the potted plant and greenery in the bottom right corner are removed.

Keep the character's original:

Facial features

Hairstyle

Clothing

Facial expression

Pose

Try to keep the original content of other areas.

Only perform background inpainting in the area where the target object is located.

If mask editing is supported,

please limit the modification area to the bottom right corner.

Case three: Duplicate texture appears in the patched area

Example: Eliminating repetitive textures

Please check the patched area in the bottom right corner of the image.

Unnatural repeating wood grain is currently appearing.

Please refer to the real texture direction of the surrounding desktop,

and regenerate a natural and continuous desktop background.

Avoid repeating patterns,

obvious patching boundaries, and blurring effects.

Only adjust the current patched area,

Keep other content as is as much as possible.

In actual use, you can remember a simple principle:Fix local issues locally, and if the main subject changes, go back to the original image and try again.


Nine, Advanced: Removing other clutter from photos

Besides this flower pot, object removal has many daily uses.

For example, when taking product photos, there is a pen on the table; in travel photos, there is a plastic bag in the background; in event photos, there is unnecessary clutter.

These can all be tried using local editing.

Scene Content to be modified Notes
** Product Photography Remove unnecessary background clutter Cannot change the actual structure of the product
** Travel Photos Remove trash on the ground Keep the original architecture and background natural
Indoor photos Remove unnecessary items from the desk Keep the furniture and spatial structure unchanged
Illustration creation Delete unnecessary decorative elements Keep the character and original art style

General object removal prompt

Example: Remove a specified object in the picture

Please edit the image I uploaded.

Objects to remove:

[Fill in object name]

Object location:

[Fill in top-left, bottom-right, center, etc. location]

Modification requirements:

Completely remove the specified object.

Clear any unreasonable residual shadows.

Naturally complete the background based on the surrounding environment.

Maintain the original image's lighting and perspective relationship.

Do not modify other subjects.

Do not add new objects.

Maintain the original image aspect ratio.

Please try to use local editing methods.

Do not regenerate the entire picture.

Directly output the modified image.

If the object's occlusion area is large, for example, covering half of a person's body or a large area of a complex building, the content the AI needs to infer will be greater, and the repair result will be less certain.


X. Advanced: AI Image Background Replacement

In addition to object removal, image editing can also replace the background.

For example, if you have a product image of a thermos and want to change the white background to a simple office desk scene.

In this case, it needs to be clear:The product appearance must not change; only the background is replaced.

Example: Replacing the Product Image Background

Please use the product image I uploaded as the basis,

Replace the background with a simple office desk scene.

[Must be retained]

Original product:

Shape

Color

Material

Proportion

Cup lid structure

Other visible details

[New background]

Light wood office desk.

Soft natural window light.

Simple background with slight depth of field.

[Requirements]

The main subject of the product remains the same.

Only replace the background area.

Add natural contact shadows that fit the environment.

Do not change the product's structure or color.

Do not add extra product parts.

Do not add text, logos, or watermarks.

Please generate a natural product scene image.

For real product promotion, the AI-generated background can be used for visual design, but it cannot cause misleading changes to the product itself.

If the original pixels of the product need to be strictly preserved, it is recommended to use subject cutout and background compositing instead of letting the generative model redraw the entire product.


Eleven, Advanced: Modify colors in the image

Sometimes the image composition is completely correct, but the color of a certain object does not meet the requirements.

For example, a chair in an illustration is blue, and we want to change it to warm orange.

This type of task can also use local editing.

Example: Only modify the color of a specified object

Please modify the image I uploaded.

Goal:

Change the blue chair in the picture to warm orange.

Modification scope:

Only adjust the chair's color.

Keep unchanged:

The chair's shape

The chair's material

The chair's position

Original lighting relationship

Background

Other objects

Color requirements:

Natural warm orange,

Retain reasonable highlights and shadows.

Do not modify other areas,

Do not redesign the chair's structure.

If strict brand colors are required, such as specified HEX or RGB values, generative editing may result in color discrepancies.

In this case, it is recommended to first use AI to complete the visual modification, and then correct the colors using professional image software or pixel detection tools.


Twelve. Advanced: Extend image edges, change canvas size

There is another very practical image editing method calledOutpainting.

It is similar to inpainting, but it is mainly used to extend areas outside the original image.

For example, we have generated a 1:1 coffee image and now want to use it for a 16:9 web banner.

If we crop it directly to a banner, the coffee cup might be cut off.

At this time, we can keep the original subject and generate more background on the left and right sides.

The difference between outpainting and cropping

Method Processing method Applicable scenarios
Cropping Deleting a part of the original image edge Sufficient space around the main subject
Outpainting Generating new scenes outside the original image Need to add background or white space
Scaling Changing image pixel size Keeping the aspect ratio the same, only adjusting the resolution

Example: Expanding a square image to a banner

Please use the 1:1 coffee image I uploaded as a basis,

and expand it to a 16:9 horizontal web banner.

Requirements:

Retain the original coffee cup body.

Do not change the shape or color of the cup.

Do not crop the coffee cup.

Primarily extend the background to the left.

Form a clean text white space area on the left.

Continue the original desktop and indoor scene.

Maintain consistency in light direction and tone.

Do not add text, logos, or watermarks.

Please use the screen expansion method,

and try to retain the existing content in the original image.

Image expansion is particularly suitable for article covers, web banners, poster backgrounds, and adapting to different screen aspect ratios.

However, the newly expanded background is content generated by the AI based on the context and does not necessarily mean that these objects or spaces actually exist in the original scene.


Thirteen, How to best ensure that other areas of the original image remain unchanged

Many users say when editing images: "Everything else remains completely unchanged except for this part."

This is indeed a reasonable requirement, but it is important to distinguish between two situations.

General AI image editing

Directly modify the original image using natural language, which is quite convenient.

However, some tools may regenerate the entire image, and even if the prompt clearly requests to keep other areas, it may not be perfectly consistent.

Mask editing plus layer composition

If higher precision is required, you can use a stricter method:

  1. Keep the original image unchanged.
  2. Create a mask that only contains the target area.
  3. Have the AI generate the patch content for this area.
  4. Composite the patched area back onto the original image as a separate layer.
  5. Check mask edges and transition effects.

This method prevents original pixels outside the mask from participating in redrawing, making it more suitable for images that require strict protection of text, logos, or character details.

Requirements Suggested method
Removing clutter from daily photos Natural language AI editing
Local background restoration Local inpainting and masking
Character facial features must remain unchanged Strictly limit masking, use layered compositing when necessary
Poster text must be exactly the same Use a separate text layer
The logo must not change Retain the original logo layer and composite it separately
Requires pixel-level precise modification Use professional image editing software or deterministic processing

Generative AI is better suited for creative modifications and background completion; pixel-level precision retention requires reliance on an appropriate editing workflow.


Fourteen, how to export after image editing

After confirming that the modification results meet the requirements, you can save the image.

It is recommended not to directly overwrite the original image, but to keep an independent version.

Recommended file naming

Image version naming examples

activity-original.png

activity-edit-v01.png

activity-edit-v02.png

activity-final.png

This way, if you find that a certain place has been over-modified later, you can revert to the original version for reprocessing.

How to choose the export format

Format Features Applicable scenarios
PNG Lossless compression, supports transparent background Illustrations, transparent materials, retains details
JPG Lossy compression, usually suitable for photographic images Photos, general web images
WebP Suitable for web use, balances image quality and size Website featured images, article covers

Since this lesson's example is an illustration, it is recommended to save a high-quality PNG first. If used for a webpage, convert it to WebP as needed.

Additionally, it is recommended to save the original image, the final image, and the editing prompts. If you used a separate mask, you can also save the mask file for easy subsequent modification.


Fifteen. Complete Example: One Prompt for Local Removal and Acceptance

If you are already familiar with the operation, you can combine the modification requirements and acceptance criteria from this lesson into one complete prompt.

Example: Complete Prompt for AI Image Local Editing

You are a professional image retouching assistant.

Based on the original illustration I uploaded,

complete a precise local edit.

[Task Goal]

Remove the white flowerpot and green plant on the bottom right of the image.

White pot and green plants.

[Modification Area]

Only process the flowerpot, leaves in the bottom right corner,

and the area where the original contact shadow was.

If masking is supported,

please prioritize local mask editing.

[Background Completion]

After removing an object:

Naturally complete the wooden desktop.

Continue the color of the surrounding walls.

Maintain the perspective relationship of the desktop.

Maintain the original light direction.

Avoid repeating textures and blurry color blocks.

Do not retain unreasonable plant shadows.

[To be kept]

Character:

Face

Hairstyle

Expression

Clothing

Pose

Other elements:

Laptop

Desk lamp

Book

Coffee mug

Notebook

Bookshelf

Wall decoration painting

[Screen requirements]

Maintain the original composition.

Maintain the original aspect ratio.

Maintain the original illustration style.

Maintain the warm tone and natural lighting.

Do not add new objects.

Do not change the text in the image.

Do not add logos, borders, or watermarks.

[Result requirements]

Output the complete edited image.

Acceptance criteria:

The pot and plant are completely gone.

The patched area is natural.

The desktop texture is continuous.

Surrounding objects show no obvious changes.

The character's appearance remains consistent.

There are no obvious editing traces.

If it is not possible to ensure complete consistency across other regions,

please try to narrow down the editing scope.

Do not redesign the entire image.

This prompt not only states what needs to be done but also clearly outlines the modification scope, protected areas, and final acceptance requirements.

For similar daily photo editing tasks, you only need to replace the target object, its location, and the content that needs protection.


Sixteen, Common Questions and Solutions

Problem Possible cause Solution
The pot did not completely disappear The selection area did not cover all leaves or shadows Appropriately enlarge the mask to cover residual areas
Blurred traces appear on the desktop Background inpainting lacks effective texture reference Re-process the local area, emphasizing texture continuity
Wood grain repetition Repeated patterns appear in the background generation Regenerate the patched area or use traditional repair tools
Changes occur in the person's face The model processed non-target areas Revert to the original image, reduce the selection area, and re-edit
Text in the image is distorted Generative inpainting affects text Keep the original text layer and recompose later
Obvious seams appear in the patched area Selection edges are too harsh or do not match the background Adjust edge transition and check lighting and shadows
The color of the entire image changes The tool performs a global redraw Use a local mask or layer composition
The exported image size is smaller Model output size or save settings are different Check pixel dimensions and re-export if necessary

General prompt for local editing corrections

Example: Correcting unsatisfactory local edits

The previous image editing result does not meet the requirements.

Please use the original image as the base again.

Issues to correct:

[Fill in specific issues]

Only modify:

Fill in the target area and object

Keep unchanged:

Fill in the content that must be retained

Please try to minimize the scope of modification.

Key checks:

Edge blending

Background texture

Light and shadow direction

Subject consistency

Image size

Do not expand the modification scope.

Do not redesign other areas.

Please output the corrected image directly.


Seventeen, Hands-on Practice

Exercise 1: Remove clutter from the desk

Prepare a photo of your own desk, for example, a desk with a cup, books, and a pen.

Have the AI only remove the pen and naturally fill in the desktop.

Check if the positions of other objects have changed.

Exercise Two: Change the color of a single object

Select a simple illustration and change the color of one object to warm orange.

Request to keep the original shape and shading of the object, without affecting other areas.

Exercise Three: Expand a square image into a banner

Select a 1:1 coffee picture and have the AI expand it to 16:9 without cropping the main subject.

Request to keep clean white space on the left, suitable for placing a title on a webpage.

Exercise Four: Comparing Different Editing Methods

Using the same original image, attempt both natural language editing and inpainting with a mask.

Compare the differences between the two methods in terms of modification scope, background restoration, and preservation of the original image.