|

What’s The Best Image Size For Stable Diffusion?

Whenever you’re creating images in Stable Diffusion, you can choose the image dimensions you want. This allows you to generate images of any size or dimension you want. 

But this often leads to a question. What’s the best image size for Stable Diffusion? 

The best image size for Stable Diffusion is 512×512 pixels which is also the default size set in Stable Diffusion. This is because Stable Diffusion is mostly trained on a dataset of images of this size. 

The image size you set in Stable Diffusion can affect how your output image looks. There are certain pros and cons of using various image dimensions. In this article, I’ll delve further into the best sizes for Stable Diffusion. 

What’s The Best Image Size For Stable Diffusion? 

Choosing the right image size in Stable Diffusion is very important as it depends on various factors such as the model you’re using, your GPU, and the purpose of your image. 

Generally, the image size of 512×512 pixels is good enough in most cases. However, the images generated at this size don’t have the same complexity or detail as images generated at higher aspect ratios. 

A user on the Stable Diffusion subreddit did a study of how output images vary in Stable Diffusion at different sizes. 

Best Image Size For Stable Diffusion

From the above image, you can clearly see the difference in the level of quality and detail of the images at various sizes. 

Generating images at a higher size will lead to a much better image but this is only possible if you have a powerful enough GPU. Without a good GPU, you’ll get an error when generating images at higher aspect ratios. 

Below is a chart with various image sizes you can use in Stable Diffusion. This will give you a general idea of what image dimensions are best for different types of images in Stable Diffusion. 

Image SizeGPU Power RequiredBest For
512×512LowIdeal size for all kinds of images
512×768MediumBest for portrait images
768×512MediumBest for landscape images
640×640HighBest for high-detail images
768×768Very High Best for high-detail images
320×320Very LowBest for lower-end GPUs
256×256Very LowBest for lower-end GPUs

If you’re wondering whether your GPU can handle generating images at a high aspect ratio, then the only way to find out is to try it out yourself. 

That’s because there are so many factors involved other than the GPU that doing a generalized test will lead to inaccurate results. 

To help you get an idea, I typically generate images at a 512×768 size without any errors on my laptop (Lenovo Legion 5) which has an Nvidia RTX 3050 GPU with 4GB of VRAM. 

At higher resolutions, I either get errors, or the image generation takes a bit longer. 

How To Make Low-Resolution Images Better In Stable Diffusion? 

Sometimes, you’ll even struggle to generate images at 512×512. If that happens, you’ll have to fall down to lower image sizes such as 320×320 or 256×256. 

But images generated at this size lack detail and don’t look that good. So, how do you make low-resolution images in Stable Diffusion look good?

Luckily, there are some methods you can use to improve your images in Stable Diffusion. 

Here are the different methods you can use to make low-resolution images look better in Stable Diffusion. 

  1. Use Well-Trained Models
  2. Increase Sampling Steps
  3. Upscale Images

Use Well-Trained Models 

Using the right model will determine how your output image looks. That’s because some models are trained at specific sizes only. 

Most of the models you’ll find on Civitai or similar websites are trained at a 512×512 aspect ratio. You can usually find the image size a model was trained in the description on Civitai. 

This means you can expect a good quality output using such models with a size of 512×512 resolution. 

You can also go higher and it’ll generate a good quality output but there will be instances where there will be repeatings or patterns generated. 

You can circumvent that by using well-trained models that are capable of generating highly detailed images at both low and high resolutions. 

But if you’re still struggling with low-resolution images even with popular models, then the next two tips will be the most helpful to you. 

Related: Stable Diffusion 3: What’s New & How To Download It

Increase Sampling Steps 

Sampling steps are the number of iterations Stable Diffusion will go through in order to generate your image. 

In other words, the higher the sampling steps, the more detailed your image output is likely to be. This also means that the computing time for image generation will be longer. 

If you’re generating images at a low size such as 512×512 pixels or even lower, consider increasing the sampling steps in Stable Diffusion. 

It will take more time to generate your image but your output is likely to be more detailed. But that’s often worth the trade-off as you’ll get a better image. 

Here’s an experiment I did where I generated an image at 512×512 at different sampling steps:

Images Generated At Different Sampling Steps In Stable Diffusion

At different sampling steps, you’ll notice how quality and detail change. Moreover, the accuracy of images also changes when sampling steps are increased. 

A general rule of thumb is using 30-35 sampling steps as it generates a quality output. You can also follow the recommended sampling steps of the model you’re using. 

Going beyond 35 steps can sometimes be overkill but it often depends on the type of image you are generating. 

Upscale Images

The best way to improve your low-resolution images in Stable Diffusion is to upscale your images to a higher resolution. 

Upscaling images in Stable Diffusion can be done in two different ways. The method that’s easy and fast is using the built-in upscale tool available in Stable Diffusion. 

You can find the upscale feature in the Extras tab in the Automatic1111 UI for Stable Diffusion

Stable Diffusion Upscaling Images

There are multiple upscalers available here that you can use to upscale your image. 

Typically, you can upscale your image by 2x or 4x depending on the original aspect ratio of your output image. Alternatively, you can also upscale your image to a specific aspect ratio. 

So, if your output image is generated at 512×512 pixels, you can upscale it by 2x or set a specific aspect ratio of, say, 1024×1024 pixels. 

In my personal tests, I’ve found upscaling the image by 2x or 4x gets the best results as the image is crisp and detailed. I’ve also tried upscaling the image by specifying a dimension but that has often resulted in errors in my case. 

Here’s an example image upscaled by 4x using the ESRGAN_4x upscaler in Stable Diffusion:

Image Upscaled Using Built-In Upscaler In Stable Diffusion

The upscaled image has more detail and you can spot the differences if you zoom into the image. 

Many models in Stable Diffusion also specify how much you should upscale the image. This is because upscaling beyond a limit can actually be detrimental to the image and the upscaled version of the image will look worse than the original. 

Recommend: ComfyUI Guide: A Stable Diffusion Interface That’s Insanely Fast

FAQs

Here are some frequently asked questions regarding image sizes in Stable Diffusion. 

Q. What are the system requirements to run Stable Diffusion? 

Stable Diffusion requires a decent GPU with atleast 6GB of VRAM, 15GB storage space, and 16GB RAM. Having a fast processor along with good thermals is also a plus as it’ll help you generate images faster. 

Q. Should I use CPU or GPU for Stable Diffusion?

You should use your GPU for generating images in Stable Diffusion as they are more fast and efficient at running deep learning models. 

Q. What’s the best GPU for Stable Diffusion? 

The best GPU for Stable Diffusion is one with a high VRAM and tensor cores as it results in optimal performance. That being said, the Nvidia RTX 4090 is currently the best GPU in the market to run Stable Diffusion. 

Recommended: How To Make Stable Diffusion Faster (Guide)

Conclusion

There’s no doubt that generating images at a higher resolution in Stable Diffusion will lead to a better image. 

Figuring out what size is the best for you in Stable Diffusion all comes down to your hardware and system capabilities. 

The final takeaway here is that you should experiment with different sizes and aspect ratios to figure out which size results in the best image for you. 

But, if you’re still unsure or overwhelmed, using 512×512 pixels is the perfect starting point as it’s the most popular and balanced size that will successfully generate an image even on some lower-end GPUs.

Stable Diffusion Prompt Organizer

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.