How To Improve Your AI Generated Images And Edit Photos With AI!

How To Improve Your AI Generated Images And Edit Photos With AI!

If you’ve spent any time playing with the free beta of our AI Image Lab image generator service, you’ve probably noticed that some of the images it creates have glaring problems with one or more aspects of the photo or illustration. This is one reason why the service provides multiple alternative images for you to choose from for each image generation process. But sometimes you may encounter a preview image that is very close to what you are looking for with only one area of the image having a defect, which commonly happens with visual features that the AI model struggles with, such as human faces. Is there any saving this image or do you just need to run another generation process and hope that there is something comparable without the same issues?

This scenario is one of the reasons we created the new AI image editing feature in AI Image Lab 0.1.8, which allows you to refine areas of AI generated images and also acts as an automatic photo editor for non-AI photos, which I’ll cover later in this post.

Iterative Refinement and Getting the Images You Want

Unless you’re a prompt-writing wizard, you may find that it’s not often that an AI image generator like AI Image Lab gives you the output that you’re looking for in the first set of images that you generate. The images may not be up to snuff due to features in the images that do not look natural, or because they don’t match your mental picture of what you are hoping to create. While AI image generation is not perfect, more often than not the key to good output is good input. Until recently, with AI Image Lab this involved repeatedly refining your prompt text to add more detail until the output becomes close enough to the image you had in your mind, possibly in conjunction with tweaking settings in the Style section of the image generation settings. But here I’ll cover a new way to iteratively refine your AI Image Lab inputs visually instead of textually, by using an image created by AI Image Lab and telling it where improvements are needed.

There’s no better way to explain how useful this new feature can be than with an example, and what better way to do that than with one of AI image generation’s nemeses: faces. Here’s an image that was generated by AI Image Lab in response to the very basic prompt businessman at a desk with the Photo style selected:

Since the prompt we used wasn’t very specific, we likely got a bunch of images that were very different from one another, all of which are different AI interpretations of the four-word phrase we provided. Let’s say that we like the features of the above image, except that the face doesn’t look quite right, which may be more evident from a slightly enlarged view:

Instead of discarding an image that we otherwise like, we can now load this generated image in the AI Image Editor by clicking the Edit button, which can be found either by hovering over the image preview thumbnail or by clicking on the preview thumbnail to open the image. Next, we can select areas of the image that we would like to edit by clicking and dragging over the image. AI Image Lab supports editing multiple regions at once, but in our case we just want to edit the face, so we can make a selection like this:

By default, the image editing feature uses the same prompt as was used for the original image, so let’s just click the Generate Images button and see what we get with that:

These are all marked improvements over the original image. However, in all but the last photo, the person behind the desk is looking to the side. Let’s say we want him to be facing the “camera” head on. We can achieve a change like this by tweaking the prompt below the image editor. Using the original image (which should still be loaded in the image editor, with the previous selection still present), and tweaking the prompt to read businessman at a desk looking straight ahead, we get:

If you look closely at these edited images, you’ll see that the edited area fits in quite well with the rest of the image. The AI image editor has seamlessly blended it in to the surrounding area and preserved the lighting of the source image, which seemed to indicate a light source like a window on the left side of the image. With a combination of selective AI image editing and a bit of text-based prompting, we’ve ended up with a number of useable images that are reasonably close to what we were looking for.

Editing “Real” Photos with AI

AI Image Lab‘s image editor can be used not only to alter features of an image, but also to add or remove objects or people from photos using AI. This applies to an iterative refinement scenario like the one described above, where you’re using the image editor within the AI image generation process to improve on the images generated by AI Image Lab, but it can also serve as an automated photo editor with a non-AI image as a starting point. As an example, let’s use this 100% non-AI photo that I took a number of years ago:

The first step to using this photo in the image editor is to upload it to the WordPress media library, if it isn’t there already. Next, we can click on the image in the Media page of the WordPress dashboard and click the Edit in AI Image Lab button that appears below the image. This will load it into AI Image Lab’s image editor.

Let’s say we want to add sailboats to the lake in this photo. We’ll need to make a selection to indicate where the edit should be made, and we should also prompt AI Image Lab to indicate what we want the edit to include (text prompting is optional when editing photos; if you omit the text prompt, the AI will have free rein to re-generate the selected area without any text-based guidance). In this case, all we need is one word, sailboat:

And we get a nice variety of sailboats to choose from:

Conclusion

I’ve shown you two examples of what the image editor in AI Image Lab is capable of, but the possibilities really are endless, both when it comes to creating the AI generated images you want and for harnessing AI to edit the content of existing images automatically based on a selection and some (optional) text-based instructions. If you haven’t already, download the free AI Image Lab plugin, join the (also free!) beta program (just follow the instructions on the plugin’s page in your WordPress admin after installation), and let your imagination loose!

Jonathan Hall

Jonathan is the lead backend WordPress developer at WP Zone.