-colorspace sRGB equivalent in magick++?

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
danieru
Posts: 10
Joined: 2014-06-13T11:48:15-07:00
Authentication code: 6789

-colorspace sRGB equivalent in magick++?

Post by danieru »

Hi everyone,

when I convert a pdf to an image the value and saturation seems wrong, but by adding -colorspace sRGB corrects the output image. Now I want to do the same in magick++ but I can't find the equivalent procedure.

I already try with colorSpace(sRGBColorspace) but it does nothing. Does anyone know how to do this with magick++?

The imagemagick's version is: 6.7.7-10
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -colorspace sRGB equivalent in magick++?

Post by fmw42 »

The imagemagick's version is: 6.7.7-10
There was a change in IM handling of colorspace about that time. You would be best to upgrade your version of IM and Magick++. Your version is about 120 releases old.

see
viewtopic.php?f=4&t=21269
danieru
Posts: 10
Joined: 2014-06-13T11:48:15-07:00
Authentication code: 6789

Re: -colorspace sRGB equivalent in magick++?

Post by danieru »

Thanks for your reply,
I update my imagemagick and is now 6.9.0-0, or at least that is what says convert -version:
Version: ImageMagick 6.9.0-0 Q16 x86_64 2014-11-17 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff x xml zlib
I also configure CodeBlocks to use magick++ 6.9.0-0 but is behaving the same as 6.7.7-10

My OS right now is: ubuntu 14.04
Last edited by danieru on 2014-11-18T00:44:57-07:00, edited 1 time in total.
danieru
Posts: 10
Joined: 2014-06-13T11:48:15-07:00
Authentication code: 6789

Re: -colorspace sRGB equivalent in magick++?

Post by danieru »

Just to clarify, this is the image I get if convert a pdf to an image using imagemagick without -colorspace sRGB.
It is also what I get if only open the pdf and save it using magick++

Code: Select all

convert -density 72 -quality 90% Blender.pdf[0] Blender.jpg
Image
http://s11.postimg.org/uf4eg2wf5/Blender.jpg


And this is the image I get if I add -colorspace sRGB. This is also how I see it on Evince.

Code: Select all

convert -density 72 -quality 90% -colorspace sRGB Blender.pdf[0] BlendersRGB.jpg
Image
http://s27.postimg.org/s0wx6n1o1/Blenders_RGB.jpg
This is the image that I want to obtain with Magick++

[Mod note: The two images didn't show, so I added them as links.]
danieru
Posts: 10
Joined: 2014-06-13T11:48:15-07:00
Authentication code: 6789

Re: -colorspace sRGB equivalent in magick++?

Post by danieru »

I should've give this links of the images instead:
Image 1
Image 2
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -colorspace sRGB equivalent in magick++?

Post by fmw42 »

Your jpg image is CMYK. If your command below is not good color quality, then you should use profiles. Also -quality should come after reading the input and just before the output. It does not use %.

Code: Select all

convert -density 72 -quality 90% -colorspace sRGB Blender.pdf[0] BlendersRGB.jpg
With profiles and assuming the pdf is CMYK like the jpg, use

Code: Select all

convert -density 72 Blender.pdf[0] -profile /path2profile/USWebCoatedSWOP.icc  -profile /path2profile/sRGB.icc  -quality 90 BlendersRGB.jpg
or from the jpg below, which produces a result that is very close to what you want

Code: Select all

convert Blender.jpg -profile /path2profile/USWebCoatedSWOP.icc  -profile /path2profile/sRGB.icc  -quality 90 BlendersRGB.jpg
danieru
Posts: 10
Joined: 2014-06-13T11:48:15-07:00
Authentication code: 6789

Re: -colorspace sRGB equivalent in magick++?

Post by danieru »

If your command below is not good color quality
No no, the color with this command is okay for me. I'm just asking how to do the same that -colorspace sRGB does but with Magick++.
But if it not possible, then something similar.

With profiles and assuming the pdf is CMYK like the jpg, use

Code: Select all

convert -density 72 Blender.pdf[0] -profile /path2profile/USWebCoatedSWOP.icc  -profile /path2profile/sRGB.icc  -quality 90 BlendersRGB.jpg
It's weird, because it seems like it should in gimp but not on gTumb or Firefox.
Screenshot
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -colorspace sRGB equivalent in magick++?

Post by fmw42 »

Sorry, I do not know Magick++. But see colorspace under image attributes at http://www.imagemagick.org/Magick++/Ima ... Attributes
Post Reply