Adobe RGB, -strip and color problem

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
SuperCed

Adobe RGB, -strip and color problem

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Adobe RGB, -strip and color problem

Post 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.
SuperCed

Re: Adobe RGB, -strip and color problem

Post 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!
SuperCed

Re: Adobe RGB, -strip and color problem

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Adobe RGB, -strip and color problem

Post 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.
SuperCed

Re: Adobe RGB, -strip and color problem

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Adobe RGB, -strip and color problem

Post 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.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Adobe RGB, -strip and color problem

Post by Bonzo »

The compare example page is here http://www.imagemagick.org/script/compare.php
SuperCed

Re: Adobe RGB, -strip and color problem

Post 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?...
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Adobe RGB, -strip and color problem

Post 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.
SuperCed

Re: Adobe RGB, -strip and color problem

Post 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.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Adobe RGB, -strip and color problem

Post 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
Post Reply