I have an Illustrator, a PNG image and an SVG file with a box filled with #041C2C
color (a dark blue).
When I'm trying to export any of these files to jpg, the image result change a little bit the red value and alter the color to #051c2c
.
I used Illustrator, Photoshop, Sketch and InVision Studio with different export settings. I also tried and online jpg generator but the downloaded image always shows the wrong color when I opened it back. In Photoshop I play with color profiles but nothing good happens.
Can any of you replicate what I did but obtaining the correct color?
Is there a method to get the original color?
Such a color cannot be stored in the JPEG format.
For the #041c2c
color, the corresponding (R, G, B) values are (4, 28, 44).
For the #051c2c
color, the corresponding (R, G, B) values are (5, 28, 44).
According to the JFIF standard, YCbCr colors (with 256 levels per component) can be computed directly from full scale 8-bit per color channel RGB colors as follows:
Y = Min(Max(0, Round( 0.299*R + 0.587*G + 0.114*B)), 255) = Min(Max(0, Round(22.648)), 255) = 23
Cb = Min(Max(0, Round((-0.299*R - 0.587*G + 0.886*B) / 1.772 + 128)), 255) = Min(Max(0, Round(140.0496614)), 255) = 140
Cr = Min(Max(0, Round(( 0.701*R - 0.587*G - 0.114*B) / 1.402 + 128)), 255) = Min(Max(0, Round(114.699001427)), 255) = 115
So the (Y, Cb, Cr) triplet is (23, 140, 115).
The inverse relationship for computing full scale 8-bit per color channel RGB values from YCbCr colors (with 256 levels per component) can be computed as follows:
R = Min(Max(0, Round(Y + 1.402 * (Cr - 128))), 255) = Min(Max(0, Round(4.774)), 255) = 5
G = Min(Max(0, Round(Y - (0.114 * 1.772 * (Cb - 128) + 0.299 * 1.402 * (Cr - 128)) / 0.587)), 255) = Min(Max(0, Round(28.1541362862)), 255) = 28
B = Min(Max(0, Round(Y + 1.772 * (Cb - 128))), 255) = Min(Max(0, Round(44.264)), 255) = 44
As you can see, the (R, G, B) values are (5, 28, 44).
No combination of YCbCr values leads to the (4, 28, 44) on the output.