Page 1 of 1

ImageMagick using wrong file intermittently

Posted: 2010-10-26T16:53:36-07:00
by DianeBlackmore
I have a facility that lets people upload an image which is distorted over another image. It works fine - most of the time, and I have narrowed this down to form posts from Explorer (IE7 and IE8). The code is as follows;

/sw/bin/convert -virtual-pixel transparent \ \( "/.../virtualuploads/large/lg_Streetlights_900w.jpg" -size 900x600 \) \ \( "/.../temp/uploadedPic.jpg" -matte +distort Perspective \ '0,0 174,124 300,0 355,127 300,224 358,403 0,224 177,400' \) \ -layers merge +repage "/.../uploadedPic_insitu.png"

(Where '...' represents the true path which I've removed in this paste). The problem here is that in Explorer, ImageMagick sometimes turns up the right background (the file "lg_streetlights_900w.jpg" in the code above) and sometimes will select another from the same directory - even though the variable output on the page will show the filename that it should be.

Does anyone know why ImageMagick would randomly select another image/file when its being told specifically which one to use? ImageMagick version is 6.4.x (sorry, can't give exact) on Linux Ubuntu Server 9.04 (current patches etc) with Apache 2.2.14.

Thanks in advance.

Re: ImageMagick using wrong file intermittently

Posted: 2010-10-26T17:04:01-07:00
by fmw42
I doubt it is ImageMagick if it only happens with IE browsers. Do I misunderstand with regard to that statement?

Could it be that your background images are a mix of rgb and cmyk and thus IE is not displaying the cmyk results correctly?

The first image in the command line will be used by IM to determine the resulting image (if one does not use -colorspace or -profiles to correct the colorspace). Furthermore PNG output does not support CMYK.

I would check your JPG files to see if they are CMYK and if so then use profiles to change them to RGB.

see http://www.imagemagick.org/Usage/formats/#profiles

identify -verbose image

will tell you whether your JPG files are CMYK or RGB

Re: ImageMagick using wrong file intermittently

Posted: 2010-10-26T23:49:16-07:00
by anthony
Also the -size option you specify does nothing!
the first set of parenthesis is also not needed.

Re: ImageMagick using wrong file intermittently

Posted: 2010-10-27T08:43:49-07:00
by dproc
I'm a little confused on exactly what you are doing, but using constant names for intermediate files (like uploadedPic_insitu.png and uploadedPic.jpg) may not be atomic--when two or more users are doing things at the same time.