Skip to main content
Known Participant
October 7, 2021
해결됨

Saving a JPG at "12" image quality. What does this do and why is the file size larger?

  • October 7, 2021
  • 3 답변들
  • 14294 조회

 When I open a JPG file and save it, I get a option to save in 1 thru 12 quality.
What does selecting 12 do besides increase the file size?

이 주제는 답변이 닫혔습니다.
최고의 답변: D Fosse

The jpeg algorithm is destructive compression. That's how it works. It's just a matter of how much.

 

It may not be immediately visible at quality 12, but if you resave over itself it will degrade a little bit each time. In addition, jpeg only supports 8 bit depth.

 

The point is that jpeg is not a working format, it's for final delivery, and then you need to decide how much destruction is visually acceptable. And with that perspective, you can often go down quite a bit with no ill effects.

 

This is the same 8 bit file saved as TIFF and jpeg quality 12. This absolutely massive size reduction comes at a cost. There is no free lunch:

 

3 답변

davescm
Community Expert
Community Expert
October 11, 2021

Hi

To understand what the control does and why data is still lost during the process regardless of its setting, it is worth understanding the steps in jpeg compression /decompression.

1. Colour transformation - the RGB image data is converted to Luminance and colour components.

2. The colour components are sampled at a lesser definition than the luminosity. This in itself loses some of the image data so is lossy.

3. The image data is split into blocks for processing using an algorithm known as the Discrete Cosine Transform which(this is not inherently lossy) but allows the next step to treat the high frequency components differently to the low frequency components.

4. The data is now quantized using algorithms that treat high frequency information differently to low but the aim throughout is to reduce the amount of data passed to the next step. This is controlled by the quality setting and the 12 setting gives more steps than lower settings. This stage is lossy and the biggest opportunity to reduce the image data in a lossy way.

5. Re-ordering and encoding using Huffman -Coding which compresses the data from the previous step but is recoverable.

 

Decompression reverses the steps, but of course the lossy steps cannot be reversed completely accurately so there is data lost at every compress/decompress, which is why the general advise is not to open (decompress) and re-save(compress) a jpeg file as losses are cumulative.

 

There is some comparative data here on the quantisation settings for different packages including Photoshop

https://www.impulseadventure.com/photo/jpeg-quantization.html

 

Dave

 

Community Expert
October 11, 2021

Thank you, @davescm 

jane-e
Community Expert
Community Expert
October 7, 2021

 


@dnemeth01 wrote:

 When I open a JPG file and save it, I get a option to save in 1 thru 12 quality.

 

When you open a jpeg and save it, don't resave it as a jpeg. Choose a format that is not lossy such as tiff or psd.

~ Jane

Community Expert
October 7, 2021

Here's my original image I got off the internet

 

 

Here's the one I saved over 100 times as JPEG max quality 

 

And I've attached the tiff showing the differences between the two.

 

I maybe missing something here - but the quality isn't degrading.

 

Community Expert
October 11, 2021

Here's a psd, and a jpeg quality 12. Look closely at the histograms. The fuzzy histogram in the jpeg version is destructive jpeg compression, at highest quality. Pixels are changed:

 


But that's saving from PSD to JPEG.

Not resaving over JPEGs.

 

I think we are talking about different things here.

 

D Fosse
Community Expert
Community Expert
October 7, 2021

The highest quality setting will inflict the least damage to the original data. But there will always be some.

 

https://en.wikipedia.org/wiki/JPEG 

 

It could be argued that saving a jpeg at quality 12 defeats the whole purpose of jpeg, which is to save bandwidth and storage space. It will be destructive in any case, so you might as well maximize payoff without losing too much quality. Around 8 is often a good compromise.

 

Don't resave a jpeg if it can be avoided! It will deteriorate with every new save. Use PSD or TIFF as working formats.

 

It should be said that content plays a part. Some types of images show the effects of the jpeg compression more easily than others, so this should be determined case by case.

 

 

Community Expert
October 7, 2021

While I agree to a degree about this - I don't think it's hugely true.

It's been proven before that image saved with Image Quality set to 12 will have no differences.

You can try it yourself by making a change to a TIFF or PSD and save it.

Save it as  JPEG with image quality 12 

Overaly the 2 using Difference blend mode and there shouldn't be any changes.

 

I think resaving images as TIFF/PSD is completely fine if you're looking to retain layers etc.

Or savng as a Photoshop PDF to retain vector masks/shapes/layers etc. would be preferred (for output) from outside Photoshop 

 

Image Quality 12 for JPEGs is the highest quality jpeg.

 

I heard this many years ago - and maybe I'm wrong - but after seeing the post now I am wondering if any Photoshop Experts can confirm this:

The PS engineers actually only had originally a scale of 0-10 and expected most people to use these settings, which gave a compression level maximum of 11 steps - which I believe or remember was the old settings in Photoshop from years ago. But the PS engineers decided to add more levels 11, and 12 (making 13). And these were left in place so that the images could be used in other applications so that the other applications would manage the compression settings.

 

For years now I believed this to be true which is why I think saving as image quality 12 allows the compression to be handled by the output settings of where the image is being used... if that makes sense.

 

So - wondering if a PS expert can confirm this - and I'll happily eat humble pie and retract my claim. 

 

However, I believe that if you're going to save as JPEG quality 12 - then why not save as TIFF or PSD - as the compression will be handled elsewhere- unless you need JPEGs for web etc or to keep file sizes down. 

 

I'm not an advocate of creating additional files for no reason other than 'that's the way it always was'.

I believe in the day - with only 11 settings you had to save as TIFF or PSD to stop discarding of info.

But I have strongly believed for years that the settings up to 13 doesn't degrade the image.

 

Would love to know.

 

 

 

 

 

 

D Fosse
Community Expert
D FosseCommunity Expert답변
Community Expert
October 7, 2021

The jpeg algorithm is destructive compression. That's how it works. It's just a matter of how much.

 

It may not be immediately visible at quality 12, but if you resave over itself it will degrade a little bit each time. In addition, jpeg only supports 8 bit depth.

 

The point is that jpeg is not a working format, it's for final delivery, and then you need to decide how much destruction is visually acceptable. And with that perspective, you can often go down quite a bit with no ill effects.

 

This is the same 8 bit file saved as TIFF and jpeg quality 12. This absolutely massive size reduction comes at a cost. There is no free lunch: