Page 1 of 1

Convert output is truncated

Posted: 2012-09-18T13:31:56-07:00
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] 

Re: Convert output is truncated

Posted: 2012-09-18T15:19:07-07:00
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]

Re: Convert output is truncated

Posted: 2012-09-18T19:07:57-07:00
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).