Compressing a photo file

RayRainer

TPF Noob!
Joined
Dec 22, 2015
Messages
2
Reaction score
0
Can others edit my Photos
Photos OK to edit
Hello. I am trying to understand how compressing picture files work. I noticed that when I used Capture NX2 to compress a file to a lesser quality, the resolution and picture size remained constant, yet it was a smaller file size. I always thought picture size and resolution determined file size and quality but apparently there is something else that makes a file size smaller. Any insight is appreciated.
 
Hello. I am trying to understand how compressing picture files work. I noticed that when I used Capture NX2 to compress a file to a lesser quality, the resolution and picture size remained constant, yet it was a smaller file size. I always thought picture size and resolution determined file size and quality but apparently there is something else that makes a file size smaller. Any insight is appreciated.

Most data is compressible for redundancy. Language for example contains compressible patterns. Scan through your post and look for two letter combinations that occur more than once. For example the letter combination "es" -- I see seven instances. Replacing every "es" with a single symbol is a 50% compression rate for each occurrence. A compression table or key is saved with the data. The compression is done for storage and transmission purposes but when the data is used it is uncompressed and restored. Redundancy compression restores the original data intact.

Redundancy compression is limited and for photos, video and music it doesn't typically get you more than a 30 to 35% compression rate. If we want more we move on to lossy compression. JPEG compression for photos is a lossy compression method. What were going to basically do then is dramatically increase the redundancy rate allowing us to achieve compression rates of 80 and even 90%. In this case however increasing redundancy requires altering the actual data so we in fact have less data. When we unpack the compression to use the data we see the same size photo but the increased redundancy remains -- we have less data. JPEG works like this: An 8x8 pixel grid is laid out over your photo. Each grid cell then contains 64 pixels. In a typical photo the odds are pretty slim that any two of those 64 pixels in a grid cell are identical. However the odds are very good that many of those pixels are very similar (think patch of blue sky). The JPEG algorithm's job is to alter the data in each cell so that instead of 64 unique pixels you have only say 32 unique pixels or even just 16 unique pixels. At those new redundancy rates massive compression becomes possible. But the data is now permanently altered. The cells are small enough and JPEG is very well designed so that you don't see the change in the data. The actual compression is only applied for storage and transmission. Every time you use the photo it's unpacked but the increased redundancy or data loss is always present and permanent.

Joe
 
Thanks Joe for you clear explanation. So, my sister has a Nikon D7100 which is way overkill for her. She takes 60 pictures which total about 1 gig. I used Capture NX2 to compress her 1gig down to 71mb to make it more manageable with her limited and declining space on her laptop. In Capture NX2, I have the option from highest compression ratio, good compression, good balance, good quality, excellent. I used "good balance" in this instance resulting in a much smaller file(s), yet still maintaining the same 300 and dpi 20x13.3 pictures size. Since the resolutions and the pictures size stay the same, how is the quality less so? How is it effected? I guess I am just wondering if there is more to this than resolution and picture size to determine "quality". I just missing something here. Why would you want the larger file sizes when the resolution and picture size stays the same? The only thing I can think of is that with the larger file size you have more information for photo manipulation, as in the case of a RAW file.
 
Thanks Joe for you clear explanation. So, my sister has a Nikon D7100 which is way overkill for her. She takes 60 pictures which total about 1 gig. I used Capture NX2 to compress her 1gig down to 71mb to make it more manageable with her limited and declining space on her laptop. In Capture NX2, I have the option from highest compression ratio, good compression, good balance, good quality, excellent. I used "good balance" in this instance resulting in a much smaller file(s), yet still maintaining the same 300 and dpi 20x13.3 pictures size. Since the resolutions and the pictures size stay the same, how is the quality less so? How is it effected?

You're talking about levels of JPEG compression. This is basically how aggressive the JPEG algorithm does it's job. We start with that 8x8 pixel grid and in all likely hood no two of the 64 pixels in each cell the same -- the data is very smooth. At high quality levels JPEG will only make the most similar pixels in the cell the same. Let's say leaving you still with 48 unique pixels. Keep reducing the quality and that ratio keeps changing till half the pixels in the cell have been rendered the same then two thirds the same and so forth -- data is no longer very smooth but getting chunky. At a small enough size on screen or print you're not going to see the data loss. Enlarge the photo and you start to see it if the quality level was brought too low.

I guess I am just wondering if there is more to this than resolution and picture size to determine "quality". I just missing something here. Why would you want the larger file sizes when the resolution and picture size stays the same? The only thing I can think of is that with the larger file size you have more information for photo manipulation, as in the case of a RAW file.

Once the JPEG grid has been laid out over a photo, even at high quality levels, further manipulation runs the risk of causing the grid to become visible.

Joe
 

Most reactions

Back
Top