EPS MagickTransformImageColorspace() colour issue
Posted: 2013-07-02T04:21:44-07:00
My question relates to EPS colorspace conversions, but ultimately it's really about how to change the format of an image in memory.
I'm using IM 6.7.5-4 (with later versions we have issues with dark JPEGs which we've not yet got to the bottom of).
I have a CMYK EPS file which I convert to RGB JPEG; however this results in colour issues - it's a black and white photo that ends up with a blue tint. I've narrowed this down to being caused by MagickTransformImageColorspace() when converting the image to RGB. There is some discussion here about this being down to Ghostscript's colour conversion:
http://www.ghostscript.com/pipermail/bu ... 02323.html
However the mentioned hacks to delegates.xml haven't worked for me (besides which, we prefer to rely on a stock IM distribution as far as possible). I'm using Ghostscript 9.05.
I don't have rights clearance to make the image available, but here is the identify -verbose output if relevant:
http://pastebin.com/JRAA1Pu6
The following code (using an in-house scripting language) produces the incorrect image:
In an attempt to avoid Ghostscript's colour conversion (if that is indeed the problem), I tried saving to another format first and then doing the colour conversion from that:
This does indeed yield a much better image, so my question is, can I do this without writing the intermediate file to disk? (I suppose what I want to do is to force IM to read the image into memory in whatever its native format is, so that it no longer delegates to Ghostscript.)
I'm using IM 6.7.5-4 (with later versions we have issues with dark JPEGs which we've not yet got to the bottom of).
I have a CMYK EPS file which I convert to RGB JPEG; however this results in colour issues - it's a black and white photo that ends up with a blue tint. I've narrowed this down to being caused by MagickTransformImageColorspace() when converting the image to RGB. There is some discussion here about this being down to Ghostscript's colour conversion:
http://www.ghostscript.com/pipermail/bu ... 02323.html
However the mentioned hacks to delegates.xml haven't worked for me (besides which, we prefer to rely on a stock IM distribution as far as possible). I'm using Ghostscript 9.05.
I don't have rights clearance to make the image available, but here is the identify -verbose output if relevant:
http://pastebin.com/JRAA1Pu6
The following code (using an in-house scripting language) produces the incorrect image:
Code: Select all
defconst MAGICK_RGBColorspace = 1
def main () {
local infile = info("argv 1")
local outfile = info("argv 2")
local w = NewMagickWand()
MagickReadImage(w, infile)
MagickTransformImageColorspace(w, MAGICK_RGBColorspace)
MagickWriteImage(w, outfile)
}
Code: Select all
defconst MAGICK_RGBColorspace = 1
def main () {
local infile = info("argv 1")
local outfile = info("argv 2")
local w = NewMagickWand()
MagickReadImage(w, infile)
MagickWriteImage(w, outfile+".png")
MagickReadImage(w, outfile+".png")
MagickTransformImageColorspace(w, MAGICK_RGBColorspace)
MagickWriteImage(w, outfile)
}