Page 1 of 1
Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T05:32:11-07:00
by mundi
Hello,
Using ImageMagick 6.9.0 I got the number the pages of a multipaged tiff using the command
Code: Select all
identify -format %n [name of tiff file]
this returned me for a specific tiff "602PS". Now after upgrading to version 6.9.1 the same command results me
"602602602602602602602...(and so on)PS".
Why is this returning the number of pages multiple times? Am I missing something or is there a bug in the newest version?
Thanks
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T07:27:26-07:00
by 246246
I don't know when it changes, but even if I use older version, only "%n" was special - "%n\n" or even "%n " produced multiple output. Probably developer has changed it for keeping consistency.
[EDIT]
I checked 6.7.6-3 on Cygwin, 6.5.4-7 on CentOS.
And for tiff, check this also.
viewtopic.php?f=1&t=28045
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T08:01:36-07:00
by mundi
For me in the 6.9.0 version it always produced the output only once, nevertheless if I use "%n", "%n\n" or "%n ".
It seems that for the latest version 6.9.1 it produces its output once per page...
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T09:06:49-07:00
by fmw42
just use identify on the first page
Code: Select all
identify -format "%n\n" yourimage.tiff[0]
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T14:20:01-07:00
by 246246
fmw42 wrote:just use identify on the first page
Code: Select all
identify -format "%n\n" yourimage.tiff[0]
It returns always 1 (in 6.9.1-10 on Windows)
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T14:52:56-07:00
by fmw42
Yes, you are right. In unix one could do:
Code: Select all
identify -format "%n\n" image.tif | tail -n 1
to get just the last value. Sorry I do not know Windows equivalent.
You could request a change in the Developers forum so that it only prints out the number of images in the current sequence once.
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T17:02:08-07:00
by 246246
In some environment or older version, I have experienced identify generate extra newline at the end. So "head -1" is safer.
In Windows CMD (without extra install), it becomes tricky,
> identify image.tiff | findstr /v /r "^$" | find /c /v ""
(findstr is for sure to remove an empty line.)
Its unix equivalent is something like
% identify image.tiff | grep -v "^$" | wc -l
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T18:31:35-07:00
by 246246
mundi wrote:For me in the 6.9.0 version it always produced the output only once, nevertheless if I use "%n", "%n\n" or "%n ".
It seems that for the latest version 6.9.1 it produces its output once per page...
Just curious what is your OS and exact version of your ImageMagick?
(I tested with 6.9.0-10 and it behaves the same as current 6.9.1-10.)
And what output is generated from your 6.9.0 for the following command?
Code: Select all
identify -format "%n %g\n" multipage.tiff
If it generate only 1 line for multipage tiff, it was bug on that version. Current behaviour would be sane, even though it is inconvenient.
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T22:05:56-07:00
by fmw42
IM 6.9.1.10 Q16 Mac OSX SnowLeopard
3 70x46+0+0
3 70x46+0+0
3 70x46+0+0
Re: Number of pages of tiff in version 6.9.1
Posted: 2015-07-28T23:33:52-07:00
by mundi
Thanks for the hints.
What I did now is that I wrote a small powershell script:
Code: Select all
$pages = identify -format "%n " [name of tiff file]
echo $pages.subString(0, $pages.indexOf(" "))
This gives me the number of pages.
Thanks for your help