Skip to content

KedarPanchal/GIMP-AI-Inpainting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

119 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GIMP AI Integration


This AI Integration plug-in brings inpainting capabilities to GIMP 3.0, allowing users to leverage powerful AI tools like Stable Diffusion XL to upgrade their image-editing workflow.

A before and after image, with the before image being that of a man in a suit and the after image being the same, but the man is now wearing sunglasses that were added in using AI inpainting.

Table of Contents


Installation


Back to top

This plug-in is only available for GIMP 3.0 and later (this includes the RC releases). In the future I may look for a method of making this compatible with GIMP 2.

MacOS

$ curl -sSL https://raw.githubusercontent.com/KedarPanchal/GIMP-AI-Inpainting/main/install.sh -o install.sh
$ bash ./install.sh

Do not run the install.sh script with elevated privileges (i.e. as sudo), as this may break where the script attempts to install the plug-in.

A note on Linux installation

Linux's distribution of GIMP 3.0—at the time of writing—comes in either AppImage or Flatpak form. Both of these formats run in a read-only sandbox environment, meaning the required dependencies for the plug-in cannot be installed. However, I do intend on seeking alternative solutions in which Python interpreters external to GIMP can be used to circumvent this issue.

Usage


Back to top

An animated GIF showing how to utilize the plugin

Click on the image to navigate to a video version of this demo!

To use the plug-in, first make a selection on the layer you wish to modify using AI and ensure that layer is selected. The selection should encompass the area you wish to modify. Then, open the plug-in by navigating to the Filters > Render menu within GIMP and clicking on the AI-Integration menu item. There, you'll be greated by a UI with the following parameters:

  • Prompt: A description of characteristics or items you want the AI model to add to the image.
  • Negative prompt: A description of characteristics or items you don't want the AI model to add to the image.
  • Steps: The number of passes the AI model makes to generate the end result. Higher values may lead to better image quality at the cost of time.
  • CFG: How strictly the AI model should adhere to your prompt and negative prompt. Higher values increase prompt adherance, but lower values allow for greater variety.
  • Strength: How much the AI model's generation should impact the original image. This value ranges from 0.0 to 1.0.
  • Seed: A value that guides the AI generation process that controls what pseudo-random numbers the AI generates. Given all of the other parameters are the same, generating two images with the same seed yields the same output. Conversely, generating two images with different seeds yields different outputs. Seeds are generated automatically by the plug-in, but can be altered by users in the plug-in UI should they wish to.
  • CPU Offloading: When checked, the CPU is utilized in conjunction with the GPU to perform the processes necessary for generating an image. This reduced the amount of VRAM used in the image generation process, but increases the generation time. On Apple Silicon devices with unified memory, this parameter has no impact.
  • Save Configuration: When checked, saves all current parameters so that their values are loaded in the next time the user opens the plug-in. When unchecked, deletes the previous configuration so that the default values are loaded in the next time the plug-in is opened.
  • Preserve Transparency: The AI model used for the inpainting process cannot handle transparent images. To fix this, the plug-in fills transparent sections with a color not found in the image. If this parameter is checked, the plug-in reverts unmasked transparent pixels to their original colors and opacities in the AI-modified image before adding it to the GIMP project. If left unchecked, the plug-in leaves the added background color in to be manually removed later on.

After inputting values for each parameter, click the OK button to run the AI, or click the CANCEL button to exit the plug-in.

Things to remember

  • When using this plug-in for the first time, the generation may take longer than usual as the AI model is being downloaded from the internet.
  • If you encounter stutters or slow-downs during the generation process, be sure to close out any unused applications and/or ensure the CPU Offloading parameter is enabled in the plug-in UI.
    • This plug-in runs the AI model on your local machine, meaning that it is resource-intensive during the generation process. Stable Diffusion XL—the model used in this plug-in—is a hefty one, requiring at least 8GB of VRAM in conjunction with 12 GB of RAM, or at least 16GB of unified memory, to run smoothly.
  • The plug-in only preserves the transparency of unmasked transparent pixels, meaning that any transparent pixels (even partially transparent ones) within the masked area will still retain the added background color described earlier.

Development Specifications


Back to top

  • Device: M4 MacBook Pro with 16GB Unified Memory
  • OS: MacOS Sequoia 15.3.2
  • Platforms: GIMP 3 RC2, GIMP 3 RC3, GIMP 3.0

License


Back to top

The GNU GPLv3 License 2025 - Kedar Panchal. Please look at the LICENSE for more information.

About

An AI Inpainting Plug-In for GIMP 3.0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors