Page 1 of 1

JPEG source files that really mess up subsequent effects

Posted: 2009-06-16T03:37:11-07:00
by nurgus
Hi all,

I've got Imagemagick integrated into my site and doing really well, but I've run into a major snag. I got a batch of jpeg images that need processing and Imagemagick's behaviour with them is very strange. The originals are huge hi-res monsters so I'm working with a crop called infile.jpg while I figure this out. I've spent days scratching my head and thoroughly searched forums and Google for an answer.

Now I'm officially giving up and asking for help!

Here's a basic example:

Code: Select all

convert infile.jpg -fill skyblue -draw "rectangle 20,10 80,80" outfile.jpg
infile.jpg:Imageoutfile.jpg:Image

Pretty obvious that's not right.. It works fine if I load infile.jpg in GIMP and save it again. But with this infile.jpg the draw colour is way out. I'm actually trying to stamp the images and do other effects, all of which are getting weird colours.

I have the same problem with versions 6.3.7 and 6.4.5, which are the versions with Ubuntu Hardy and Jaunty, and also the version on my webhost 6.5.2-9. The problem is obviously inherent to the jpeg files I have, but what can I do to fix it automatically?

Thanks.

Re: JPEG source files that really mess up subsequent effects

Posted: 2009-06-16T10:14:38-07:00
by fmw42
your infile is cmyk. change it to rgb

convert infile.jpg -colorspace rgb -fill skyblue -draw "rectangle 20,10 80,80" outfile.jpg


This works for me.

Re: JPEG source files that really mess up subsequent effects

Posted: 2009-06-16T11:28:43-07:00
by nurgus
Hey,

Wow, as easy as that!

I tried to examine the files with GIMP but it didn't seem to see anything odd with them. I guess it converts CMYK silently when it loads the image, which would explain why they worked after being loaded/saved.

This graphics n00b can now deploy these updated arguments, sit back and stop stressing. Hehe. 8)

Many thanks again.

Re: JPEG source files that really mess up subsequent effects

Posted: 2009-06-16T13:06:04-07:00
by fmw42
you can examine the image information in IM using identify -verbose imagefile