AWARE [SYSTEMS]
AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
October 2014

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



New Datamatrix section



Valid HTML 4.01!



Thread

2014.10.15 04:10 "tiff2pdf page ordering", by Richard Nolde
2014.10.15 13:54 "Re: tiff2pdf page ordering", by Bob Friesenhahn
2014.10.15 14:32 "Re: tiff2pdf page ordering", by Olivier Paquet
2014.10.15 20:45 "Re: tiff2pdf page ordering", by Shailender Bathula
2014.10.20 17:57 "Re: tiff2pdf page ordering", by Olivier Paquet

2014.10.15 04:10 "tiff2pdf page ordering", by Richard Nolde

I think the problem lies in how the page number tags are being written
in the tiff file.
As I understand it, and see in TIFF files from dozens of makers and
models in our image processing environment, the Page number values
represent the page sequence number and, optionally the total number of
pages in the file.  It is permissible to have zero for the total number
of pages, particularly if the TIFF file is being written on the fly
without knowing how many pages will end up being written.

tiffinfo 123.tiff | grep Number
  Page Number: 0-1
  Page Number: 0-2
  Page Number: 0-3

It should produce something like the following if you don't know the
total number of pages at the time of writing
tiffinfo 123.tiff | grep Number
  Page Number: 0-0
  Page Number: 1-0
  Page Number: 2-0

OR
 the following if you buffer all your pages in memory until you know how
many you will have in the file.
tiffinfo 123.tiff | grep Number
  Page Number: 0-3
  Page Number: 1-3
  Page Number: 2-3

You can look at the code for writing TIFFTAG_PAGENUMBER in tiffcp or
tiffcrop.
Poking at a file produced by one of our Ricoh based scanners produced
the following output:

tiffinfo /archive/testimages/latest/20141008145637343.tif | grep Number
  Page Number: 0-158
  Page Number: 1-158
  Page Number: 2-158
  Page Number: 3-158
  Page Number: 4-158
  Page Number: 5-158
  Page Number: 6-158
  Page Number: 7-158
---
  Page Number: 157-158

Given what you are writing into the PAGENUMBER tag, the qsort must be
reordering the output.
Richard Nolde

tiffinfo 123.tiff
TIFF Directory at offset 0xe6 (230)
  Image Width: 344 Image Length: 287
  Resolution: 120, 120 pixels/inch
  Bits/Sample: 1
  Compression Scheme: CCITT Group 4
  Photometric Interpretation: min-is-white
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 287
  Planar Configuration: single image plane
  Page Number: 0-1
TIFF Directory at offset 0x2a8 (680)
  Image Width: 344 Image Length: 287
  Resolution: 120, 120 pixels/inch
  Bits/Sample: 1
  Compression Scheme: CCITT Group 4
  Photometric Interpretation: min-is-white
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 287
  Planar Configuration: single image plane
  Page Number: 0-2
TIFF Directory at offset 0x484 (1156)
  Image Width: 344 Image Length: 287
  Resolution: 120, 120 pixels/inch
  Bits/Sample: 1
  Compression Scheme: CCITT Group 4
  Photometric Interpretation: min-is-white
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 287
  Planar Configuration: single image plane
  Page Number: 0-3

pdfinfo 231.pdf
Producer:       libtiff / tiff2pdf - 20120922
CreationDate:   Tue Oct 14 17:53:07 2014
ModDate:        Tue Oct 14 17:53:07 2014
Tagged:         no
Pages:          3
Encrypted:      no
Page size:      206.4 x 172.2 pts
File size:      3251 bytes
Optimized:      no
PDF version:    1.1