Page 1 of 1

Adobe RGB, -strip and color problem

Posted: 2007-10-25T06:06:00-07:00
by SuperCed
I have thousands of jpeg images embeding Adobe RGB profile.
The problem is that those images are about 35Ko and they can be about 5Ko.
It's very important for me to reduce the size (Ko) of my images.

So, I tried to use 2 solutions with the convert command to remove the profile :

Code: Select all

convert -strip 08_350_A.jpg 08_350_A_bis3.jpg
and

Code: Select all

convert -profile "*" 08_350_A.jpg 08_350_A_bis3.jpg
In all cases, I have a very small JPEG - about 5Ko which is very good - thank you Imagemagick

But colors are a little bit different from the orginal picture, it seems to be lighter and colors are fader.
Do you know how can I keep the good colors with this size ?

I tried to add -contrast option, but it's still not exactly what I want. I don't want to keep exact colors, but colors quite near from the original.

Thank you

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T07:20:12-07:00
by magick
The colors are expected to be different because you have stripped the color profiles which specify how to present the colors to your output device and because JPEG is lossy.

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T08:01:20-07:00
by SuperCed
Thank you so much for this quick answer!

Do you know how can I get quite good results for small size, removing the color profile?

It's not very important to keep the exact color, but it will be better if I am able to be near the original.

Thanks!

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T08:39:38-07:00
by SuperCed
I will try to show difference

Original image :
Image

Code: Select all

convert -strip  1257_350_A.jpg 1257_350_A_bis.jpg
Image

Code: Select all

convert -strip -contrast 1257_350_A.jpg 1257_350_A_bis2.jpg
Image

Code: Select all

convert -strip -normalize 1257_350_A.jpg 1257_350_A_bis3.jpg
Image

As you see, there are several differences, which is normal. But I want to know what can be the best for me, keeping in mind that size (ko) is very important for me.

Thanks

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T08:50:34-07:00
by magick
You can quantify the differences with identify and compare. Identify returns
  • Channel statistics:
    Red:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 210.462 (0.825341)
    Standard deviation: 59.2852 (0.232491)
    Green:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 201.247 (0.789203)
    Standard deviation: 70.7498 (0.27745)
    Blue:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 195.889 (0.768194)
    Standard deviation: 75.1888 (0.294858)
for the original image and
  • Channel statistics:
    Red:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 210.457 (0.825321)
    Standard deviation: 59.2858 (0.232494)
    Green:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 201.247 (0.789203)
    Standard deviation: 70.7478 (0.277442)
    Blue:
    Min: 0 (0)
    Max: 255 (1)
    Mean: 195.884 (0.768173)
    Standard deviation: 75.1838 (0.294838)
for the converted image. The compare program returns a MAE of 36.6015 (0.000558503) showing a very small normalized difference in the image. Mathematically there is very little difference between the images. Of course there would be no difference in pixel color if you used a lossless image format such as PNG.

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T08:59:44-07:00
by SuperCed
I cannot use png file.

I have to find another solution.

What do you suggest? Using normalize?
How can you compare values, I am not familiar with compare command.

Thank you, you helped me a lot

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T09:08:02-07:00
by magick
If you want an exact color match you must use a lossless image format. If you use JPEG you will get slight color differences.

The compare command looks like this:
  • compare -metric mae 1257_350_A.jpg 1257_350_A_bis.jpg difference.png
Now look at difference.png to visualize where the colors have changed.

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T09:12:34-07:00
by Bonzo
The compare example page is here http://www.imagemagick.org/script/compare.php

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T09:15:05-07:00
by SuperCed
I don't want exact color, but the nearest I can have with jpeg format. But it's not so important too have exact colors.

I tried the difference on the 3 generated images and I have that :

Image

Image

Image


It seems that the first is the best.

Can I add the difference picture to the generated picture to have a picture near the orginal?

Maybe I have to use a sharpen filter with the difference image?...

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T09:35:42-07:00
by magick
You need to do some research on the JPEG image format. JPEG uses a lossy DCT transform which means you can't recover the color loss while using JPEG. Only a lossless image format can completely recover the original image pixels exactly.

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T09:40:54-07:00
by SuperCed
Do you know if there is a way to kark the color of the picture with imagemagick?
Or maybe, it can be ok if I am able to saturate colors of those pictures. Do you know how to do it?

I know JPEG is lossly but I think main problem is because I remove the color profile. So Maybe if I can saturate or dark the images, it can be ok.

Thank you, I think I will find something.

Re: Adobe RGB, -strip and color problem

Posted: 2007-10-25T13:44:39-07:00
by Bonzo
This looks a bit better to me; but I am no an expert :lol:

Code: Select all


convert http://superced.dyndns.org/pictures/forum/1257_350_A.jpg -strip  -quality 100 1257_350_A_bis3.jpg

compare -metric mae http://superced.dyndns.org/pictures/forum/1257_350_A.jpg 1257_350_A_bis3.jpg difference.png

?>
Original
Image
New - A bit lighter ?
Image
Difference
Image