IM 6.6.0-9 Q16 Mac OSX tiger
When trying to get the number of scenes from a pdf or gif, the number of scenes repeats once for each scene. For example:
convert rose: rose: rose: rose3.gif
convert rose.gif -format "%n" info:
3
3
3
I would expect only one 3 to be returned.
Same with
convert rose: rose: rose: rose3.pdf
convert rose.pdf -format "%[scenes]" info:
3
3
3
Let me know if this is the correct behavior.
possible bug with string formats "%n" and "%[scenes]"
Re: possible bug with string formats "%n" and "%[scenes]"
-format is applied to each image in a sequence. For each image in the sequence, they all have the same sequence length of 3. Its a bit redundant but given that -format is an image operator rather than an image sequence operator the behavior is expected. To fix, we would need to create a new option that applies to an image sequence rather than one an image by image basis.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug with string formats "%n" and "%[scenes]"
magick wrote:-format is applied to each image in a sequence. For each image in the sequence, they all have the same sequence length of 3. Its a bit redundant but given that -format is an image operator rather than an image sequence operator the behavior is expected. To fix, we would need to create a new option that applies to an image sequence rather than one an image by image basis.
Thanks for the explanation. Here is a work around:
echo `convert rose.gif -format "%n" info:` | cut -d\ -f1
3
(note there needs to be two spaces between the \ and -f1)
And this just gets the last scene number, so you can add 1 to it to get the number of scenes.
convert rose.gif[-1] -format "%s" info:
2