summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2011-03-26 12:07:20 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2011-03-26 12:07:20 +0000
commita9a1d1c65fb5c3ac97b3be8e6e1786c5004035f9 (patch)
tree1d18c5e9589ea9928c54465c92377cf417a25b9a
parent94e26a9e897829bd69790fdd4c9b561f478cc899 (diff)
downloadlibtiff-git-a9a1d1c65fb5c3ac97b3be8e6e1786c5004035f9.tar.gz
Add -d and -sd switches to tiffset to allow operation on a particular
directory instead of just the first (jef)
-rw-r--r--ChangeLog5
-rw-r--r--man/tiffset.116
-rw-r--r--tools/tiffset.c22
3 files changed, 41 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index febcd6aa..71080674 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-26 Frank Warmerdam <warmerdam@pobox.com>
+
+ * tools/tiffset.c: add -d and -sd switches to allow operation on
+ a particular directory, not just the first (jef).
+
2011-03-21 Frank Warmerdam <warmerdam@pobox.com>
* libtiff/tif_thunder.c: Correct potential buffer overflow with
diff --git a/man/tiffset.1 b/man/tiffset.1
index a732293d..ed0d12fb 100644
--- a/man/tiffset.1
+++ b/man/tiffset.1
@@ -1,4 +1,4 @@
-.\" $Id: tiffset.1,v 1.4 2009-12-03 19:27:55 fwarmerdam Exp $
+.\" $Id: tiffset.1,v 1.5 2011-03-26 12:07:20 fwarmerdam Exp $
.\"
.\" Copyright (c) 1988-1997 Sam Leffler
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -41,9 +41,15 @@ sets the value of a
header to a specified value.
.SH OPTIONS
.TP
+.BI \-d " dirnumber"
+change the current directory (starting at 0).
+.TP
.BI \-s " tagnumber" "\fR [\fP" " count" "\fR ]\fP" " value ..."
Set the value of the named tag to the value or values specified.
.TP
+.BI \-sd " diroffset"
+change the current directory by offset.
+.TP
.BI \-sf " tagnumber filename"
Set the value of the tag to the contents of filename. This option is
supported for ASCII tags only.
@@ -72,6 +78,14 @@ tiffset \-s 282 300.0 a.tif
tiffset \-s 283 300.0 a.tif
.fi
.RE
+.PP
+Set the photometric interpretation of the third page of a.tif to
+min-is-black (ie. inverts it):
+.RS
+.nf
+tiffset -d 2 -s 262 1 a.tif
+.fi
+.RE
.SH "SEE ALSO"
.BR tiffdump (1),
.BR tiffinfo (1),
diff --git a/tools/tiffset.c b/tools/tiffset.c
index 090262f5..b9e58364 100644
--- a/tools/tiffset.c
+++ b/tools/tiffset.c
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: tiffset.c,v 1.15 2010-07-06 14:30:38 dron Exp $
+ * $Id: tiffset.c,v 1.16 2011-03-26 12:07:20 fwarmerdam Exp $
*
* Project: libtiff tools
* Purpose: Mainline for setting metadata in existing TIFF files.
@@ -41,6 +41,8 @@ static char* usageMsg[] = {
"usage: tiffset [options] filename",
"where options are:",
" -s <tagname> [count] <value>... set the tag value",
+" -d <dirno> set the directory",
+" -sd <diroff> set the subdirectory",
" -sf <tagname> <filename> read the tag value from file (for ASCII tags only)",
NULL
};
@@ -86,6 +88,24 @@ main(int argc, char* argv[])
return 2;
for( arg_index = 1; arg_index < argc-1; arg_index++ ) {
+ if (strcmp(argv[arg_index],"-d") == 0 && arg_index < argc-2) {
+ arg_index++;
+ if( TIFFSetDirectory(tiff, atoi(argv[arg_index]) ) != 1 )
+ {
+ fprintf( stderr, "Failed to set directory=%s\n", argv[arg_index] );
+ return 6;
+ }
+ arg_index++;
+ }
+ if (strcmp(argv[arg_index],"-sd") == 0 && arg_index < argc-2) {
+ arg_index++;
+ if( TIFFSetSubDirectory(tiff, atoi(argv[arg_index]) ) != 1 )
+ {
+ fprintf( stderr, "Failed to set sub directory=%s\n", argv[arg_index] );
+ return 7;
+ }
+ arg_index++;
+ }
if (strcmp(argv[arg_index],"-s") == 0 && arg_index < argc-3) {
const TIFFField *fip;
const char *tagname;