summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2010-06-03 17:01:01 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2010-06-03 17:01:01 +0000
commit13ab8a93b6270b1a2c74726718dbf4eec4f2adf0 (patch)
tree25b75e0c05384900d2775f3c60ad50f7261a556a
parent2dacef9ea0ac033a30150335ae438e0e6ef0b65a (diff)
downloadlibtiff-git-13ab8a93b6270b1a2c74726718dbf4eec4f2adf0.tar.gz
added -x switch to tiffcp to (re)number allt he pages (#2203)
-rw-r--r--ChangeLog7
-rw-r--r--html/man/tiffcp.1.html14
-rw-r--r--man/tiffcp.15
-rw-r--r--tools/tiffcp.c27
4 files changed, 46 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 1be4ead0..4c98b3ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-06-03 Oliver Chen Feng <scip8183@gmail.com>
+
+ * libtiff/tools/tiffcp.c: add a new option -x to force merged tiff
+ file PAGENUMBER value in sequence for users who care the page
+ sequence, this will also prevent tiff2pdf from creating pdf file from
+ the merged tiff file with wrong page sequence.
+
2010-05-08 Olivier Paquet <olivier.paquet@gmail.com>
* libtiff/tif_dirread.c: Restored TIFFReadDirEntryFloat function in order
diff --git a/html/man/tiffcp.1.html b/html/man/tiffcp.1.html
index 1df15951..4c7fcb62 100644
--- a/html/man/tiffcp.1.html
+++ b/html/man/tiffcp.1.html
@@ -341,6 +341,20 @@ of data appear in a tile.</p>
</td>
<td width="0%">
</td>
+<tr valign="top" align="left">
+<td width="10%"></td>
+<td width="3%">
+
+<p><b>&minus;x</b></p>
+</td>
+<td width="5%"></td>
+<td width="80%">
+
+<p>Force the output file to be written with PAGENUMBER value
+in sequence.</p>
+</td>
+<td width="0%">
+</td>
</table>
<!-- INDENTATION -->
<table width="100%" border=0 rules="none" frame="void"
diff --git a/man/tiffcp.1 b/man/tiffcp.1
index b1b40015..e2f03d9f 100644
--- a/man/tiffcp.1
+++ b/man/tiffcp.1
@@ -1,4 +1,4 @@
-.\" $Id: tiffcp.1,v 1.9 2007-02-24 11:19:33 dron Exp $
+.\" $Id: tiffcp.1,v 1.10 2010-06-03 17:01:02 fwarmerdam Exp $
.\"
.\" Copyright (c) 1988-1997 Sam Leffler
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -210,6 +210,9 @@ appear in a tile.
attempts to set the tile dimensions so that no more than 8 kilobytes of data
appear in a tile.
.TP
+.B \-x
+Force the output file to be written with PAGENUMBER value in sequence.
+.TP
.BI \-,= character
substitute
.I character
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index 64009076..484c22aa 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -1,4 +1,4 @@
-/* $Id: tiffcp.c,v 1.43 2010-03-10 18:56:50 bfriesen Exp $ */
+/* $Id: tiffcp.c,v 1.44 2010-06-03 17:01:02 fwarmerdam Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -92,6 +92,7 @@ static void usage(void);
static char comma = ','; /* (default) comma separator character */
static TIFF* bias = NULL;
static int pageNum = 0;
+static int pageInSeq = 0;
static int nextSrcImage (TIFF *tif, char **imageSpec)
/*
@@ -170,7 +171,7 @@ main(int argc, char* argv[])
*mp++ = 'w';
*mp = '\0';
- while ((c = getopt(argc, argv, ",:b:c:f:l:o:z:p:r:w:aistBLMC8")) != -1)
+ while ((c = getopt(argc, argv, ",:b:c:f:l:o:z:p:r:w:aistBLMC8x")) != -1)
switch (c) {
case ',':
if (optarg[0] != '=') usage();
@@ -258,6 +259,9 @@ main(int argc, char* argv[])
case '8':
*mp++ = '8'; *mp = '\0';
break;
+ case 'x':
+ pageInSeq = 1;
+ break;
case '?':
usage();
/*NOTREACHED*/
@@ -402,6 +406,7 @@ char* stuff[] = {
" -c g4 compress output with CCITT Group 4 encoding",
" -c sgilog compress output with SGILOG encoding",
" -c none use no compression algorithm on output",
+" -x force the merged tiff pages in sequence",
"",
"Group 3 options:",
" 1d use default CCITT Group 3 1D-encoding",
@@ -733,11 +738,21 @@ tiffcp(TIFF* in, TIFF* out)
}
{
unsigned short pg0, pg1;
- if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {
- if (pageNum < 0) /* only one input file */
- TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
- else
+
+ if (pageInSeq == 1) {
+ if (pageNum < 0) /* only one input file */ {
+ if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1))
+ TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
+ } else
TIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);
+
+ } else {
+ if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {
+ if (pageNum < 0) /* only one input file */
+ TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
+ else
+ TIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);
+ }
}
}