Struggling with color, output coming out neon

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
bowentw
Posts: 4
Joined: 2014-06-09T08:47:40-07:00
Authentication code: 6789

Struggling with color, output coming out neon

Post by bowentw »

Hi all,

I'm new to imagemagick so bear with me....

I'm converting a series of ai files to jpg/png, but I'm having some trouble matching the color. The output seems to have a kind of 'neon' effect to it. I'm sure it's a colorspace or a conversion issue but any help or guidance would be greatly appreciated. The ai files are in cmyk space. Here's my python code...

Code: Select all

for file in self.filteredFiles:
                        print('Converting ' + file)
                        myFileName = file.split('/')[1]
                        print(myFileName)
                        #myConvertName = file[:-3] + '.jpg'
                        #print(myConvertName)
                        with Image(filename=file, resolution = (RESOLUTION,RESOLUTION)) as myFile:     
                                myFile.resolution = RESOLUTION
                                myFile.depth = 32
                                myFile.format = 'png'
                                myFile.type = 'truecolor'
                                myFile.colorspace = 'cmyk'
                                myConvertName = myDir + '/' + 'default_' + myFileName[:-2] + 'png'

                                with myFile.convert('jpg') as converted:
                                        converted.depth = 32
                                        converted.colorspace = 'rgb'
                                        converted.save (filename = myConvertName)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Struggling with color, output coming out neon

Post by snibgo »

I don't know enough python, but "converted.depth = 32" is probably wrong. In IM, depth is bits/channel/pixel, so you probably want "8".

Sample files would help diagnosis.
snibgo's IM pages: im.snibgo.com
bowentw
Posts: 4
Joined: 2014-06-09T08:47:40-07:00
Authentication code: 6789

Re: Struggling with color, output coming out neon

Post by bowentw »

I'm afraid I can't provide too much of the image, but this should give you an idea (input on left, output on right). Basically the commands in python are the same as the standard command line but in a different syntax.

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Struggling with color, output coming out neon

Post by fmw42 »

This is likely due to using IM to change colorspace using -colorspace equivalent in your API. You should use profiles to go from CMYK to sRGB.

see
http://www.imagemagick.org/Usage/formats/#profiles
bowentw
Posts: 4
Joined: 2014-06-09T08:47:40-07:00
Authentication code: 6789

Re: Struggling with color, output coming out neon

Post by bowentw »

Perfect! That did the trick! Thank you Fred!
Post Reply