ImageMagick using wrong file intermittently

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
DianeBlackmore

ImageMagick using wrong file intermittently

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick using wrong file intermittently

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick using wrong file intermittently

Post by anthony »

Also the -size option you specify does nothing!
the first set of parenthesis is also not needed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dproc
Posts: 19
Joined: 2010-09-14T20:39:15-07:00
Authentication code: 8675308

Re: ImageMagick using wrong file intermittently

Post 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.
Post Reply