RGB values change saving png to jpeg
Copy link to clipboard
Copied
Hi, I have an issue, I'm working on a brand colour R165 G24 B144 (hex: A51890) - Now when I save this as a PNG and reopen the file it stays in the RGB value breakdown but when I save it as a jpeg (sRGB checked and unchecked) the colour value shifts to: R166 G24 B144.
Is there any way I can get the jpeg to stay in the same RGB value - I've even tried filling a blank document with the colour and it still alters the R value when saving as a jpeg.
I've tried both RGB and sRGB and the same issue happens.
Explore related tutorials & articles
Copy link to clipboard
Copied
This is normal. This is what jpeg compression does. That massive file size reduction has a price.
If you need to preserve the numbers accurately, don't use jpeg.
Copy link to clipboard
Copied
Is there any definitive documentation from Adobe answering this colour issue regarding jpeg compression?
Only because if a client questions this, it would be great to back this up with official explanations or even select colour palettes which work on the print and digital colour values with no issues.
Copy link to clipboard
Copied
jpg does not belong to Adobe, but I trust Wikipedia offers a decent article on it.
The compression (used in what we commonly refer to as »jpg«) works on the basis that human visual perception is more astute for luminance than for color, so color gets compressed more strongly.
As @D Fosse already recommended you should not use lossy compression if you can’t accept the image degredation it causes.
Copy link to clipboard
Copied
It's not Photoshop, it's jpeg. Jpeg is a destructive file format, and this is it.
If you squeeze a file down to 5% or so of its native size, there is a price. There is no free lunch.
Copy link to clipboard
Copied
And funnily enough with certain images a non-lossy compression like LZW can even result in smaller files than jpg.
Copy link to clipboard
Copied
" select colour palettes which work on the print and digital colour values with no issues."
There is no colour palette or trick that you can use to stop JPEG changing colours. That's what it does, by design and absolutely deliberately, except for very rare accidents. That's why it's called "lossy". Your client needs to know this, just as you do. Consider: why do you think there is a quality setting for JPEG? A quality setting would have no meaning if what it saved was exact. (No, maximum quality doesn't mean "no change").
Copy link to clipboard
Copied
Actually there are a large range of RGB Pantones that do match when saving down to jpeg, as some of the other people above have highlighted, there are certain luminosities that are so fine in conversion, that the values can alter, it's just been a very long time since that has happened in this instance of saving an RGB value in jpeg form and then opening it to inspect and seeing a tiny shift in values. As stated, the client's colour palette is 7 colours, all are fine bar this one value when saved in any RGB format.
Luckily from further investigation, we are moving away from jpegs for brand assets for clients unless they specify that they require them, then they will have a caveat attached to any work being processed in that way, there could be colour issues.
I do know about this having worked in branding for over 18 years but wanted to see if anyone else within this community has come across this colour shift more often, knowing how Adobe can alter certain aspects of their software which we then have to investigate for the clients to make sure that we have a version that works until the issues have an update.
Copy link to clipboard
Copied
The way jpeg compression works is that it compresses the color information more than the luminosity. It is also lossy compression so does not restore the image back to its original state when decompressed. It is very good at keeping file sizes down but is not the best way to keep the original information.
Some reading :
https://en.wikipedia.org/wiki/JPEG#Encoding
https://en.wikipedia.org/wiki/Chroma_subsampling
Dave
Copy link to clipboard
Copied
Hi Simon, I can replicate your problem if I use Export or Save For Web.
However, if I Save As... JPEG the values match your PNG’s—I tried a number of compression settings and they all matched. A new document filled with the color and Saved As JPEG also reopens unchanged.
Copy link to clipboard
Copied
Save For Web
Save As Medium 7:
Copy link to clipboard
Copied
When you look at what has happened to those images it is perhaps surprising that they come back with only a difference of 1 in one RGB channel, bearing in mind that the Save As and Save for Web encoding processes are likely to have different internal coding of the functional steps below and therefore different errors introduced to the encode process.
Jpeg is not designed to return a round trip of exact numbers (other formats with lossless compression are) - but is designed to give a perceived similar image following a quite severe reduction in stored image data.
Starting with RGB there is :
1. A conversion from RGB to YCrCb This is to a standard formula but will be subject to any rounding used in the calculations
2. Subsampling of the colour channels which effectively quarters the information in each of the two colour channels
3. A discrete cosine transform of each 8x8 block of data in each of the YCrCb channels, designed to separate the information crucial to definition from that which is almost imperceptible to the eye.
4. Quantization which is where the "quality" control comes into play and is where the lossy part of jpeg happens
5. Lossless encoding of the data
Decoding, when the file is opened, reverses all those steps, but as stated above any rounding in conversion will potentially introduce an error as will the lossy quantisation.
Dave

