Stable Diffusion and JPEG Quality

Stable Diffusion and JPEG Quality

Aug 04, 2024

Stable Diffusion and JPEG Quality

JPG/JPEG is an image format in which the content of the original image is compressed. This is done with the loss of information that is not visible or is difficult to see.

The Web UI Easy Diffusion uses a compression rate of 75% by default and the Web UI AUTOMATIC1111 uses a compression rate of 80% by default .

The question now was how to determine the compression rate or quality if the input values are unknown, no longer known, or so much time has passed that it is no longer possible to remember changed settings.

I used the following image to save several images with different compression rates.

A great tool for doing this and that with images is ImageMagick. To get the quality value of an JPG/JPEG image one command from ImageMagick can be used. This is simple as it is.

identify -format '%Q' example.jpg

The resulting quality is printed without line break. In case of the image from above I saved the image using 80% which is the standard from AUTOMATIC1111.

If one needs more information about the image, one can use another option.

identify -verbose example.jpg

The last command results in a long list with informations from filename up to the ImageMagick version and in between data like compression and quality.


Have a nice day! See you back soon!


Reference

[1] https://imagemagick.org/

[2] https://imagemagick.org/script/identify.php

Enjoy this post?

Buy zentrocdot a coffee

More from zentrocdot