Color space changes after convert ?

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?".
bakman
Posts: 5
Joined: 2012-07-24T01:04:29-07:00
Authentication code: 15

Color space changes after convert ?

Postby bakman » 2012-07-24T01:23:48-07:00

I noticed a subtle difference in my photos after they are converted (they are black and white - in sRGB).
It appears that the color space has changed to "gray", how can I keep it exactly the same during/after conversion ?

Image

I am only performing a "convert -resize".

User avatar
fmw42
Posts: 15129
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: Color space changes after convert ?

Postby fmw42 » 2012-07-24T10:20:35-07:00

What version of IM? What is the image format (PNG, JPG, ...?)

Your input image is black and white only. It is labeled as RGB which IM now interprets as linear. Since it is not color, IM processes it and converts it to linear gray. This has been recent changes to IM to conform more properly to standards.

In order to get the output to be RGB again, try

convert image -resize ... -set colorspace RGB output

bakman
Posts: 5
Joined: 2012-07-24T01:04:29-07:00
Authentication code: 15

Re: Color space changes after convert ?

Postby bakman » 2012-07-27T00:30:07-07:00

Thanks.

I am using ImageMagick 6.7.8-6.
Input/output is jpg.

I have tried to add the -set colorspace RGB, but same result in the output image: colour space - gray.

When opening the output image in photoshop I also receive this error:
The embedded ICC profile cannot be used because the ICC profile is invalid. Ignoring the profile.

User avatar
fmw42
Posts: 15129
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: Color space changes after convert ?

Postby fmw42 » 2012-07-27T09:46:44-07:00

Can you post a link to one of your images? I can try to test it.

bakman
Posts: 5
Joined: 2012-07-24T01:04:29-07:00
Authentication code: 15

Re: Color space changes after convert ?

Postby bakman » 2012-07-27T10:38:10-07:00

Original (resized in PS).
Output

Used the following:

Code: Select all

convert -resize x600 sample.jpg -set colorspace RGB sample_output.jpg

User avatar
fmw42
Posts: 15129
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: Color space changes after convert ?

Postby fmw42 » 2012-07-27T11:26:18-07:00

It works fine for me under IM 6.7.8.6 Q16 Mac OSX Snow Leopard


Image: sample.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 600x900+0+0
Resolution: 300x300
Print size: 2x3
Units: PixelsPerInch
Type: Palette
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit


convert sample.jpg -resize x600 sample_test1.jpg

Image: sample_test1.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 400x600+0+0
Resolution: 300x300
Print size: 1.33333x2
Units: PixelsPerInch
Type: Palette
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit


Note proper IM 6 syntax should have the input image right after convert, though it may not make a difference until IM 7

see
http://www.imagemagick.org/Usage/basics/#why

bakman
Posts: 5
Joined: 2012-07-24T01:04:29-07:00
Authentication code: 15

Re: Color space changes after convert ?

Postby bakman » 2012-07-28T01:03:06-07:00

I see the same when using identify.
When you do a cmd+i on the sample image (or use preview with the inspector) - it states:

sample.jpg: colour space: "RGB" with colorprofile: sRGB
sample_output: colour space: "gray" with colorprofile: sRGB

Try opening in photoshop and you will receive an ICC error on the sample_output.jpg

User avatar
fmw42
Posts: 15129
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: Color space changes after convert ?

Postby fmw42 » 2012-07-28T10:36:58-07:00

That is not what I get from

convert sample.jpg -resize x600 sample_test1.jpg

From Mac info, the input and output shows identical information including colorspace RGB, and profile sRGB IEC61966-2.1.

I get no errors from opening the output in PS CS.

I am on Mac OSX Snow Leopard using IM 6.7.8.6 Q16

Have you tried using my command. Your syntax with -resize before the input is not proper IM 6 syntax and may or may not be the issue.

How did you install IM? I installed manually from source. If you installed a binary, perhaps it was not compiled correctly.

What version of libjpeg are you using? Mine is 80

bakman
Posts: 5
Joined: 2012-07-24T01:04:29-07:00
Authentication code: 15

Re: Color space changes after convert ?

Postby bakman » 2012-07-28T12:02:39-07:00

i'll be damned, the syntax difference indeed does the trick, thanks.

How do you install from the source on OSX ?
I used this "installer"-script (I manually updated some versions here and there).

User avatar
fmw42
Posts: 15129
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: Color space changes after convert ?

Postby fmw42 » 2012-07-28T13:45:18-07:00

How do you install from the source on OSX ?


I first install all my delegate libraries via MacPorts. Then rather than waiting for macports to create a version of IM, I install IM from source code available at http://www.imagemagick.org/download/. I modify the normal install instructions for the ./configure command from http://www.imagemagick.org/download/www ... .html#unix and customize it using certain options from http://www.imagemagick.org/script/advan ... lation.php

so I do

./configure ....
make
sudo make install

My ./configure command is:

./configure CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
--enable-delegate-build --enable-shared --disable-static --disable-opencl \
--with-modules --with-quantum-depth=16 --with-gslib --without-wmf \
--disable-silent-rules --disable-dependency-tracking --disable-openmp \
--with-gs-font-dir=/opt/local/share/ghostscript/fonts/ --with-lqr

The first two options in blue are the ones that link IM installed at /user/local/bin to my delegates installed by MacPorts at /opt/local/bin


Return to “Users”

Who is online

Users browsing this forum: Bing [Bot] and 4 guests