Skip to main content
Participating Frequently
September 17, 2021
Pregunta

RGB values change saving png to jpeg

  • September 17, 2021
  • 3 respuestas
  • 2045 visualizaciones

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. 

Este tema ha sido cerrado para respuestas.

3 respuestas

rob day
Community Expert
Community Expert
September 19, 2021

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.

rob day
Community Expert
Community Expert
September 19, 2021

 

Save For Web

 

 

 

Save As Medium 7:

 

 

 

 

davescm
Community Expert
Community Expert
September 19, 2021

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

davescm
Community Expert
Community Expert
September 19, 2021

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

D Fosse
Community Expert
Community Expert
September 17, 2021

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.

Participating Frequently
September 17, 2021

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. 

Legend
September 19, 2021

" 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").