Photopea is a good, free, in-browser image editor that I've found myself using when working on AI art. While there are already extensions for more fully fledged programs such as Krita and Photoshop, they're geared towards largely local installs (so unusable if you're using remote AI services*), and the programs are either paid or a pain. So here's a few of the ways I've found myself using Photopea in my workflow.
AUTOMATIC1111 Extension
There's an extension that adds Photopea as a tab within AUTOMATIC1111's UI, with some extra integration. I've not used it, though.
The Basics
Photopea already has its own site for guides and tutorials, and functions similarly to most image editors out there, so I may assume some familiarity of concepts in this. For those who don't know what they're doing but are willing to jump in and hope to figure things out as they go, I will try to add a bit more direction than might be necessary, but I make no promises.
I will cover just a few handful of things that regularly catch me out, though:
- When starting out, use
File -> Save as PSD
to properly save the project. When you want to save it out as an image, useFile -> Export as -> PNG
. - The Move Tool (
V
) defaults to Auto-Select enabled, which makes it really awkward to reliably transform what you want to - it's better to disable it, so you can manually select the layers/folders you want to move. It also has Transform controls disabled by default, which you'll want to enable if you want easy access to the Rotate/Scale/Distort functions it has. - The paint bucket is hidden behind the Gradient Tool (
G
). You can access it by longpressing the gradient tool in the sidebar, or by toggling through the modes withShift + G
. - To add an image to your project, you can drag and drop it into either the main window or the layers tab to add it to a layer. If you want to open that image as part of a new project instead, you can drop it near the area where all the project names are listed, in the upper area of the main window.
- You can add layers from other images by selecting them in the layers panel, right clicking, then selecting
Duplicate into...
. From there you can set the Destination to be one of the projects you currently have open, or a new one.
Basic Recolours
Until the day that we can perfectly describe the colour we want, the AI is going to fail us. But if we remember the first rule of AI Directing - don't expect the AI to do all the work - we can start fixing that with a bit of beginner-level image editing.
Image Tutorial
You can find an image-based version of this tutorial here!
Start the Mask
- Create a layer folder for the edits, and place it above the main image. We'll be using this to both keep things organised, and restrict our recolours only to the areas we want to edit.
- To restrict the area to only the area we want to recolour, we'll need to add a mask. To start with, add an empty mask via
Layer -> Raster Mask -> Add (Hide All)
. - Loosely draw the mask so it covers the whole area - we'll refine it later. To do this, remember to select the mask in the layers panel, and paint the area with a solid white brush. I prefer to temporarily add in a layer to the folder so I can see what I'm doing - something like a solid colour with it's Blend Mode set to something obvious, like
Color Burn
,Divide
, orDifference
(if you do this, remember to hide the layer when you're done).
Adjust the Colours
For adjusting the colours, add a Hue/Saturation layer via Layer -> New Adjustment Layer -> Hue/Saturation
, and place it at the top of the folder. Double click the layer to start adjusting its settings.
This adjustment layer has 2 styles, depending on whether or not Colorize
is enabled.
- No Colorize: Colours will be shifted around, maintaining a separation between them. Hue will slide all the colours along the colour spectrum, Saturation will boost/reduce their existing vividness, and Lightness will adjust their lightness.
- Colorize: Colour's Hue and Saturation are made uniform to match the colour defined by the sliders. The Hue and Saturation sliders are used to define the colour that everything's changed to, while Lightness continues to adjust lightness. If using this, you may want to modify the layer's opacity slightly to bring back in some variation between colours.
It's honestly best to just leave you to experiment with the settings to find something you like, as the visual feedback is very obvious.
More Detailed Control
A Hue/Saturation layer is fine for quick and easy edits, but for better quality changes you'll need other tools (and more effort). The most involved method would be to create 2 layers - one with Color Blend Mode, and the other with Luminosity Blend Mode. With the first, you can control the exact colours (hue + saturation) of the image at a pixel level, allowing for more variety in colours, and the second will give similar control for lightness.
Finish the Mask
Once everything has been set up, return back to the folder mask to refine it. Zoom in and clean up the edges as best you can. Remember that there's a softer brush in the brush menu (right click) that you can use for feathering the edges to make things blend better.
Making Inpaint Masks
So, you've doodled in something to help guide your generation along, and want to make an accurate mask for the inpaint? Here's how.
Accurate inpaint masks aren't really that necessary when you're also doing image editing. So what if you're a bit sloppy with the inpaint mask? You can just manually cut out the areas you didn't want to change when editing the output in Photopea.
Image Tutorial
You can find an image-based version of this tutorial here!
- Save the normal version of your image with the edited areas via
File -> Export as -> PNG
. - For ease of use, create a folder above all the other layers and name it something useful like "Inpaint mask".
- Copy/Move all the layers with your manual edits into that folder. What? You have been making your edits non-destructive by creating them on layers separate from the main image, right? If not, you've got some manual masking to do!
- Once the layers are all in the folder, open the Layer Style menu on the folder. You can do that by either double clicking the area to the right of the folder's name in the Layers panel, or by selecting the folder in the Layers panel and going to
Layer -> Layer Style -> Blending Options
. - Open the Color Overlay option and check it to enable it. This option will replace all the pixels in your layers with a single colour, which is perfect for making an inpainting mask of the area you've edited! In the menu, set the colour to full white (for AUTOMATIC1111's UI), or whatever colour's used to mark the inpaint area for the interface you're using.
- Next, open the Outer Glow option and also enable it. This will add a "glow" of extra pixels around the area you've edited, which we can use to add some padding pixels around our inpaint mask. Then, set the following options:
- Blend Mode: Normal
- Opacity: 100%
- Set the colour to full white - or your interface's appropriate colour - be selecting the coloured box to the left of "Gradient". The default is an off-white that might be hard to notice, so don't get fooled by that.
- Technique: Precise (though it really doesn't matter that much)
- Spread: This controls the softness of the transition from masked to unmasked. I prefer to have a hard transition, especially as soft transitions work weirdly in AUTOMATIC1111's UI, so set this to 100%
- Size: This will control how many pixels of padding there is around the area where you've made your edits. I prefer something in the 5 pix mark. This'll be affected by the mask padding settings in your AI interface too, so bear that in mind.
- For the background of the inpainting mask, create a full black layer via
Layer -> New Fill Layer -> Color Fill
and selecting black. - Place this color fill layer just below the "Inpaint mask" folder, but not inside the folder.
- Congratulations, you've got an accurate inpaint mask! Use
File -> Export as -> PNG
to save it. Then you can use the eyeball to hide the "Inpaint mask" folder and the black background layer. You can re-use these later for your next inpaint mask - just replace the layers within the folder with your newest edits.
warn Mask Blur
Be aware that AUTOMATIC1111 UI's "Mask Blur" option will end up shrinking the mask you've drawn - disable it or lower the values if you were tight with your padding, otherwise not all of the area you've masked will actually get affected by the inpaint!
Alpha Masks
If your AI Interface prefers alpha masks for their inpaint areas instead of white blocks, the Color to Alpha function found in Filter -> Other -> Color to Alpha
might help. Set the Color to be white, and it should swap it to being transparent (though you'll likely need to make more changes to the workflow for this).
Segmentation Maps
Assuming you've been weirdly vigilant in your separation of layers, you may be able to use the Color Overlay effect for other things, such as segmentation maps. Just make sure the fill colour is the appropriate colour for the object.
Reusing Layer Styles
Photopea includes a few methods you can use to reuse this style if you don't want to have to go through the gruelling task of enabling two whole options. You can either:
- Copy/Paste styles: To do this, locate the layer/folder you want to copy the style from in the Layers panel and right click it. Go to
Layer Style
and selectCopy
. Then do the same to the layer/folder you want to add the style to, but choosePaste
instead. - Save Styles: You can save and load layer styles for later reuse. To do this, open the Layer Style menu on the layer whose style you'd like to save. After configuring your style, select the "Define New" button to create the style. Then press the black square with the the down arrow just beneath the button to open the list of saved styles. In the panel that pops up, right click the new style and choose
Name Change
to give it an appropriate name. Once that's done, click the downward arrow on this panel, and selectExport as .ASL
to save it. Any time you want to load that style at a later date, you can use theLoad .ASL
option in that same option to load your saved file, then select it from the list to use it.
Making Scribbles
Drawing Scribbles for ControlNet's associated model is very helpful in guiding things towards what you want - either for a full piece, or for individual inpaints as I more commonly use them for. Now, drawing something as basic as a scribble input probably shouldn't warrant its own guide, but here's the setup I use to make things easier:
- For ease of use, create a folder above all the other layers and name it something useful like "Scribble".
- Create a new layer and place it in the folder.
- On that layer, draw the outlines you want to use for your scribble. Don't worry about colours at all - pick whatever contrasts well with your underlying reference images (if you're using any), for your benefit. If this is for an inpaint, you should try and encompass anything that'll be within the inpaint's vicinity.
- Once finished, we can now translate these lines to white, which is what's used for the line colour in scribble maps. To start, select the layer and go to
Layer -> Layer Style -> Blending Options
. - Open the Color Overlay option and check it to enable it. In the menu, set the colour to full white. This'll change all your lines to white regardless of their original colour.
- For the background of the mask, create a full black layer via
Layer -> New Fill Layer -> Color Fill
and selecting black. - Place this color fill layer just below your lines layer in the "Scribble" folder.
- Use
File -> Export as -> PNG
to save the scribble mask.