Convert output is truncated

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
btilford
Posts: 3
Joined: 2012-03-21T09:36:21-07:00
Authentication code: 8675308

Convert output is truncated

Post by btilford »

I'm having an intermittent issue where the output from convert is truncated resulting in only a partial image. When using identify it doesn't report anything as being invalid and I am able to find the EOI tag in the output file. This seems to occur more often with the 2nd code example I'm guessing it is about 1/1000.

Code: Select all

convert tmpDir/*.* +clone -resize 1000x1000 -set filename:f resized/%t_1000.%e +adjoin -write %[filename:f] +clone -resize 600x600 -set filename:f resized/%t_600.%e +adjoin -write %[filename:f] +clone -resize 320x320 -set filename:f resized/%t_320.%e +adjoin -write %[filename:f] -resize 80x80 -set filename:f presets/%t_80.%e +adjoin %[filename:f] 

Code: Select all

convert file.jpeg -resize 80x80 -set filename:f presets/%t_80.%e +adjoin %[filename:f] 
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert output is truncated

Post by fmw42 »

Just a guess, but try putting -set before -resize

convert file.jpeg -set filename:f -resize 80x80 presets/%t_80.%e +adjoin %[filename:f]
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert output is truncated

Post by anthony »

fmw42 wrote:Just a guess, but try putting -set before -resize

Code: Select all

convert file.jpeg -set filename:f -resize 80x80 presets/%t_80.%e +adjoin %[filename:f]
-set needs a extra string argument which was "presets/%t_1000.%e" your argument order is incorrect. Also the [...] should be quoted to avoid special meaning by the shell.

Code: Select all

convert file.jpeg -set filename:f 'presets/%t_80.%e'  -resize 80x80 +adjoin '%[filename:f]'
Warning: the %e will work in this case, but a file suffix provided by a percent escape is not used for determination of the image file format. This could be seen as a bug (or a security feature).


Warning in the latest IM's a single character % escape after a number loses the 'escape substitution' meaning unless followed wrapped by '[..]'

EG: 'presets/100%t' has no percent escapes (% is literal not an escape due to the number), but 'presets/100%[t]' does.
This awkwardness is to avoid problems with using '%' escapes in geomerty arguments that take a '%' flag normally.

For example in IMv7 is "-resize 50%x50%" a resize by 50%, or a resize by "50{X-density}50%" or for a typical 72 dpi image "507250%"

The above rule makes it resize by 50%. I fthe later was whated it should be espressed as "50%[x]50%".
This rule was backported to IMv6 (with lots of other percent escape additions).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply