AI Image Generation in the HackerNoon Editor (with Stable Diffusion)

cover
1 Nov 2022

Hello HackerNoon writers 👋 I have an exciting announcement to announce:

Published writers can now generate images using Stable Diffusion! 🥳

You will see a new option at the bottom in the image upload modal. It has a little eye icon 👁️ next to it, can’t miss it. Just be aware that we currently rate limit each user to 10 images an hour. If an error pops up saying NSFW content was detected, this will not count towards this limit. Just edit the prompt and try not to be so gross next time. 😁

Anywho, just type in what you’d like to see in the image and press enter or the Submit button , then wait a bit while we go talk to replicate.com to generate your image. It takes a bit because we first generate a 768 × 512 pixel image and then send the image to another endpoint to “upscale” the image using Real-ESGRAN. After this the image becomes 1536 × 1024 pixels in size and edges and small details become more defined.

Here is a before and after of that process:

"giant insectoid aliens"

Not bad… weird, but not bad!

upscaled giant insectoid aliens!

Viola! The “shells” have finer details. All the edges are more clearly defined. The clouds and grass are more realistic in appearance. The image has become larger and more HD. 👍

Writer’s Block

Coming up with a good prompt to get the results you want is its own challenge. There are plenty of sites and documents around the web with advice and tips on how to write a good prompt. https://publicprompts.art/ is one such site. You may be surprised to see that prompts can get quite long and somewhat redundant. The more details you provide as input, the higher quality the output tends to be. Guides written for other image generation software like DALL-E 2 will also be applicable with Stable Diffusion.

Publicprompts.art showcasing various prompt ideas

Future Iterations

In the future I would like to implement the image to image feature where you can iterate on an image, changing the prompt each time (if you’d like) to gradually sculpt the image closer to your original intentions. There is also the option to mask a part of the image and only regenerate that portion of the image, this is commonly referred to as “Inpainting“.

That’s all for now, have a great day.✌️