Monday, December 16, 2024

Use Generative AI to expand an image in Krita

I was playing around with the Generative AI Diffusion plugin for Krita (https://github.com/Acly/krita-ai-diffusion) but I could not figure out how to expand an image for a while. Eventually, I learnt how to get the job done by doing the following steps, illustrated below.

  1. Load in an image you want to expand, e.g. a Halloween pumpkin, in Krita.
    The image to be expanded loaded in Krita



  2. Next, select the crop command in the tool palette, or press C on the keyboard. Then click on the image itself.
    Handles appear around the image



  3. Use the mouse to drag the handles in the direction to be expanded, e.g. to the left.

    Drag the handle to the left in the expansion direction


  4. Now, double click in the empty expanded area.

    The image is resized but empty of content in the expanded area



  5. Click the Rectangular Selection tool or press CTRL-R. Drag out the empty expanded area to define a rectangle.

    Select the area for AI image generation



  6. In the AI Image Generation docker, choose an appropriate style, e.g. Digital Artwork. Type in a suitable prompt, e.g. Halloween pumpkin still life, pastel style. Then press the Expand button.

    Choose a style and enter a prompt


  7. A preview of the AI generated image appears as shown below. You can see the AI has taken the image context and prompt to fill in the empty expanded area.