Monday, June 20, 2016

compression - Why do JPEG files blur red more than other colors?


I am trying to figure out why JPEG compression causes noise in the red spectrum that is larger and fuzzier in regards to, say, the blue spectrum. I've seen this question and I am not looking for a workaround; I just want to know why red is prone to more distortion during compression.


This behavior is highly visible in 'political campaign' images (where the picture is rendered in red, blue, and some shade of tan), but is visible elsewhere too. Here is an example:
Image of Spock in red, light blue, and tan. Notice the border along the red side?



Answer




Everything @Scott said is true but for better understanding of the WHY and even how come RED seems to look worse, I direct you to this information (emphasis mine and edited for flow)



JPEG ... is designed for compressing either full-color or gray-scale images of natural, real-world scenes [and] is a lossy compression algorithm...


JPEGs are best suited for continuous tone images like photographs or natural artwork; not so well on sharp-edged or flat-color art like lettering, simple cartoons, or line drawings. JPEGs support 24-bits of color depth or 16.7 million colors.


JPEG is actually just a compression algorithm, not a file format. JPEG is designed to exploit certain properties of our eyes, namely, that we are more sensitive to slow changes of brightness and color than we are to rapid changes over a short distance.


While JPEGs are usually the best choice for photographs, on 8-bit monitors they are force-dithered into an 8-bit palette. JPEG compression is treated as 24 bit data (8 bit for gray), regardless of the colors in the original image. Therefore, if you reduce an image from 24-bit to 8-bit prior to JPEG compression, the compression ratio will actually worsen as will the overall quality.


JPEG compression introduces noise into solid-color areas, which can distort and even blur flat-color graphics. This is why JPEGs are not well suited to flat-color sharp-edged art or type. A JPEG can reduce a 900K 24-bit image to 45K (high quality) or 30K (medium quality), a factor of 20:1 to 30:1. With JPEGs, however, the more you compress, the more edge definition and sharpness you lose. JPEGs do not support transparency, either.


It is important to note that saving a graphic to JPEG format with compression should be a last step. Compression effects are cumulative. This means that every time you re-save a JPEG file, you are compressing it further, and thereby tossing away data (photographic detail) that you can't get back.



Now for the super technical details that explain the prevalence of the RED (which is a trick on the eye actually) you might want to read this information (again emphasis is mine)




The starting point of the JPEG compression are the pixels in the primary colors red, green and blue, which are for a lossy compression is not optimally suited. Before the actual compression simply convert the RGB colors, for example, in the YCrCb model that the first channel stores the pure brightness information (Y), so the average of the brightness of the red, blue and green channel. Stores in the second channel is the deviation of the red channel of the average brightness, and in the third channel, the deviation of the blue channel. The value for the green channel can be calculated from this and does not need to be specially recorded. Once you have separated as components luminance (brightness) and chrominance (color), you can reduce the resolution of the two chrominance channels to half or a quarter, as they for the sharpness does not matter. The visual cortex of humans contains independent systems for the perception of colors and shapes, and the color-blind would ignore the former fine resolution color boundaries anyway, the color detection system works again with a three to four times as low resolution as the form of recognition.



Hope that helps you understand better all that's going on.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...