Jump to content

Exactly what does the quality setting do?


Recommended Posts

Obviously it can be used to reduce image quality, resulting in a smaller file size

You seem to already have the hang of it.

This image shows a progressive quality decrease going from left to right. Lower quality allows the image to have a smaller file size.

Phalaenopsis_JPEG.png

Are you asking about the technical aspect of exactly how the JPEG algorithm decides what details can be destroyed in the interest of compression? 'Cause, well, I dunno.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

A bit more detailed answer:

JPEG works by changing each 8x8 pixel block in the image into frequency domain (using discrete cosine transform, if you want to look it up). These frequencies have amplitudes. Before they are compressed, the JPEG compressor divides the amplitudes with a value and saves that value to the file. It's an integer division, so it loses information.

Pretend there's a 2x2 pixel image. When converted to frequency domain, its amplitudes might be something like

37 36

30 21

If you divide all these values by 1 before compression, you have lossless compression, since when you decompress, you get the exact same values back.

If you (integer) divide all these values by 2, they become

18 18

15 10

And when you decompress the file, by multiplying the saved values by 2, you get

36 36

30 20

These are not exactly the same values as were put in, so the compression becomes lossy.

Divide by 10 and you get

3 3

3 2

Which becomes

30 30

30 20

upon decompression, which is already quite a significant difference to the original. On the other hand, the preprocessed data contains a lot of repetition (3, 3, 3, 2), which is easy to compress, so the file becomes smaller.

That is what the JPEG quality option does on a technical level. Smaller quality values = bigger divider = more quality loss.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...