How to get number of pages in Tiff file?

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: helmut, XnTriq, xnview

How to get number of pages in Tiff file?

Postby punith8626 » Thu Feb 02, 2017 11:26 am

Hello,

I have multipage tiff and I wanted to get number of pages in tiff.

Is there any way to get number of pages in tiff page?.If so what is the command for the same ?
punith8626
 
Posts: 9
Joined: Thu Feb 02, 2017 11:22 am

Re: How to get Number of pages in Tiff Page ?

Postby cday » Thu Feb 02, 2017 11:37 am

punith8626 wrote:I have multipage tiff and I wanted to get number of pages in tiff.

Is there any way to get number of pages in tiff page?.If so what is the command for the same ?

You want to extract the pages of a multi-page TIFF file to separate TIFF files, or possibly just read the number of pages?

The command to extract the pages of a multi-page file is:

Code: Select all
-xall
cday
XnThusiast
 
Posts: 1334
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to get Number of pages in Tiff Page ?

Postby punith8626 » Thu Feb 02, 2017 12:13 pm

I want to just read the number of pages in tiff.

Like in image magic we use command identify to read the number of pages in tiff
punith8626
 
Posts: 9
Joined: Thu Feb 02, 2017 11:22 am

Re: How to get Number of pages in Tiff Page ?

Postby cday » Thu Feb 02, 2017 12:23 pm

punith8626 wrote:I want to just read the number of pages in tiff.

Like in image magic we use command identify to read the number of pages in tiff

This should be the NConvert equivalent, if you could check if it shows the number of pages:

Code: Select all
-info             : Display informations only

The procedure for creating a listing of the NConvert Help file is given in this post, if you don't have one already.
cday
XnThusiast
 
Posts: 1334
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to get Number of pages in Tiff Page ?

Postby punith8626 » Thu Feb 02, 2017 12:29 pm

-Info will give all information about the file. But I need to have only number of pages.
punith8626
 
Posts: 9
Joined: Thu Feb 02, 2017 11:22 am

Re: How to get Number of pages in Tiff Page ?

Postby cday » Thu Feb 02, 2017 12:42 pm

punith8626 wrote:-Info will give all information about the file. But I need to have only number of pages.

There is no specific option for that as far as I know... :(

ImageMagick has many more options, but NConvert also has some advantages including faster processing, I believe, and the ability to process input and output files in directories... :D
cday
XnThusiast
 
Posts: 1334
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to get Number of pages in Tiff Page ?

Postby 0617 » Wed Mar 15, 2017 7:56 am

Type in command line. Replace 1.tif with your file name.
With leading space though.

Code: Select all
S:\>for /F "usebackq tokens=2 delims=:" %i in (`nconvert -info 1.tif ^| find "Page(s)"`) do @echo %i
3
S:\>

Or create command file pages.cmd
No leading space!

pages.cmd
Code: Select all
@echo off
set PAGES=
for /F "usebackq tokens=2 delims=:" %%i in (`nconvert -info %1 ^| find "Page(s)"`) do set "PAGES=%%i"
set "PAGES=%PAGES:~1%"
echo %PAGES%
set PAGES=


Result:
Code: Select all
S:\>pages 2.tif
6
S:\>
0617
 
Posts: 1
Joined: Wed Mar 15, 2017 7:36 am

Re: How to get number of pages in Tiff file?

Postby cday » Wed Mar 15, 2017 8:45 am

Thank you for posting your solution 0617! :D

Sadly the very cryptic notation required rather limits the use of cmd.exe by casual users to provide solutions to problems...
cday
XnThusiast
 
Posts: 1334
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.


Return to NConvert

Who is online

Users browsing this forum: No registered users and 3 guests