Page 1 of 1
How to get the number of images
Posted: 2015-11-27T03:15:34-07:00
by kankan_lee
Some times the ImageMagick convert 1 file to a few images, named by -0, -1, -2....
How can I get the number of the images? I guess there should be some variable I can use directly.
Thanks!
Re: How to get the number of images
Posted: 2015-11-27T11:03:18-07:00
by fmw42
try
Code: Select all
convert image -format "%n\n" info:
that will give you the total number of scenes repeated for each scene. So you have to do some further processing to extract just one of them.
see
http://www.imagemagick.org/script/escape.php.
For example:
Code: Select all
convert rose: rose: rose: rose: rose.gif
Code: Select all
convert rose.gif -format "%n\n" info:
4
4
4
4
or in unix you can do
Code: Select all
convert rose.gif -format "%n\n" info: | head -n 1
4
Always best to provide your IM version and platform when asking question on this forum, since IM syntax and scripting differ between unix and windows.