Color-Problem when converting

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
modads
Posts: 3
Joined: 2014-08-06T01:15:37-07:00
Authentication code: 6789

Color-Problem when converting

Post by modads »

Hi there,

i use jmagic to resize user-uploaded images on a web page.
Here i have some image, which are not be able to show correctly in firefox.
For them i tried to do a conversion, but i can't get it working. I even try some icc color profiles.

Maybe someone have an idea a) how to detect such images and b) how to convert it correctly.

Here one of the images:
http://www.imgbox.de/show/img/LcdFDmdNdT.jpg

> the colors are wrong in firefox, ie handle it fin, my image viewer (irfanview) also.


Code looks similar to: (i try all adobe icc profiles, because i expected one of them, but no success):

Code: Select all

...
                ImageInfo origInfo = new ImageInfo(); //load image info
                MagickImage image = new MagickImage(origInfo, data); //load image

                image.setColorProfile(new ProfileInfo(filename, iccProfile));
                image.rgbTransformImage(ColorspaceType.RGBColorspace);

...
thanks a lot
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Color-Problem when converting

Post by snibgo »

"identify" shows that your image is CMYK. Computer screens are red, green and blue. Perhaps different software converts differently. I suggest that you use sRGB for consistency across browsers.
snibgo's IM pages: im.snibgo.com
modads
Posts: 3
Joined: 2014-08-06T01:15:37-07:00
Authentication code: 6789

Re: Color-Problem when converting

Post by modads »

I don't have any choice which images the users upload.
I have to support such images, so (and that is the question of this topic): how to i convert such images, with correct colors?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Color-Problem when converting

Post by snibgo »

This image doesn't have an embedded profile, so you can only guess at the correct method of converting to sRGB.

The simplest method is "-colorspace sRGB".

A more complex method is to assign one of the CMYK profiles, and convert to one of the sRGB profiles, for example:

Code: Select all

-profile USWebCoatedSWOP.icc -profile sRGB.icc
snibgo's IM pages: im.snibgo.com
modads
Posts: 3
Joined: 2014-08-06T01:15:37-07:00
Authentication code: 6789

Re: Color-Problem when converting

Post by modads »

snibgo wrote: A more complex method is to assign one of the CMYK profiles, and convert to one of the sRGB profiles, for example:

Code: Select all

-profile USWebCoatedSWOP.icc -profile sRGB.icc
Have i any chance to get (maybe only the name) of the used color profile?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Color-Problem when converting

Post by fmw42 »

If you are on a current version of IM, see the string formats at http://www.imagemagick.org/script/escape.php

%[profile:icc] ICC profile info
%[profile:icm] ICM profile info
%[profiles] list of any embedded profiles

convert image -format "%[profiles]" info:
or
identify -format "%[profiles]" yourimage

otherwise, you will need to parse that from identify -verbose yourimage
Post Reply