multiple files and %[filename:...] handling.

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

multiple files and %[filename:...] handling.

Post by anthony »

Code: Select all

  convert eye.gif news.gif storm.gif    -scale 200% \
          -set filename:f '%t_magnify.%e' '%[filename:f]'
This works, except that all three files are being saved to the first file name!
That is not a bug, it is what I would expect.

What is a bug is that the result however is NOT a 'GIF animation'.
that is each of the three images are being saved separately to the the
first file name, as separate images with separate opens/closes.

Note however, that adding '+adjoin'

Code: Select all

  convert eye.gif news.gif storm.gif    -scale 200% \
          -set filename:f '%t_magnify.%e'  +adjoin '%[filename:f]'
and we get three separate image files, as we should.

The first (-adjoin) case is incorrect, no matter how you look at it.
The second (+adjoin) is correct handling.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: multiple files and %[filename:...] handling.

Post by magick »

We get:
  • -> convert eye.gif news.gif storm.gif -scale 200% -set filename:f '%t_magnify.%e' '%[filename:f]'
    -> identify eye_magnify.gif
    eye_magnify.gif[0] GIF 64x64 64x64+0+0 8-bit PseudoClass 8c 2.5KB
    eye_magnify.gif[1] GIF 64x64 64x64+0+0 8-bit PseudoClass 8c 2.5KB
    eye_magnify.gif[2] GIF 64x64 64x64+0+0 8-bit PseudoClass 8c 2.5KB
Isn't that the expected behavior?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: multiple files and %[filename:...] handling.

Post by anthony »

Yes it is. Sorry it seems I didn't see the animation, because there was no -loop 0.

My bad... Thanks.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: multiple files and %[filename:...] handling.

Post by anthony »

Hmmm but changing the suffix of the file doesn't.

Code: Select all

convert eye.gif news.gif storm.gif -scale 200% \
       -set filename:f '%t_magnify.png' +adjoin '%[filename:f]'
Saves GIF files into filenames with a .png suffix.

Code: Select all

file news_magnify.png
news_magnify.png: GIF image data, version 89a, 64 x 64

Of course I could force it by also adding a PNG: prefix...

Code: Select all

convert eye.gif news.gif storm.gif -scale 200% \
       -set filename:f '%t_magnify.png' +adjoin PNG:'%[filename:f]'
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply