Page 1 of 1

possible bug with string formats "%n" and "%[scenes]"

Posted: 2010-03-25T19:32:48-07:00
by fmw42
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.

Re: possible bug with string formats "%n" and "%[scenes]"

Posted: 2010-03-25T19:47:07-07:00
by magick
-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.

Re: possible bug with string formats "%n" and "%[scenes]"

Posted: 2010-03-25T19:54:29-07:00
by fmw42
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