summaryrefslogtreecommitdiff
path: root/tools/tiffset.c
diff options
context:
space:
mode:
authorAndrey Kiselev <dron@ak4719.spb.edu>2010-07-06 14:30:38 +0000
committerAndrey Kiselev <dron@ak4719.spb.edu>2010-07-06 14:30:38 +0000
commit897e7e9491dbb77177ac9d6ddef78a80c8644e8a (patch)
treeda11a8dcee9ef4c43dc7604728d18d8e306a8119 /tools/tiffset.c
parent1cf8becfc29c6b0a935191a55cefd3b4e5e69ce7 (diff)
downloadlibtiff-git-897e7e9491dbb77177ac9d6ddef78a80c8644e8a.tar.gz
Properly handle TIFFTAG_PAGENUMBER, TIFFTAG_HALFTONEHINTS,
TIFFTAG_YCBCRSUBSAMPLING, TIFFTAG_DOTRANGE which should be set by value.
Diffstat (limited to 'tools/tiffset.c')
-rw-r--r--tools/tiffset.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/tools/tiffset.c b/tools/tiffset.c
index c4f306f1..090262f5 100644
--- a/tools/tiffset.c
+++ b/tools/tiffset.c
@@ -1,5 +1,5 @@
/******************************************************************************
- * $Id: tiffset.c,v 1.14 2010-03-10 18:56:50 bfriesen Exp $
+ * $Id: tiffset.c,v 1.15 2010-07-06 14:30:38 dron Exp $
*
* Project: libtiff tools
* Purpose: Mainline for setting metadata in existing TIFF files.
@@ -27,27 +27,6 @@
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
******************************************************************************
- *
- * $Log: tiffset.c,v $
- * Revision 1.14 2010-03-10 18:56:50 bfriesen
- * * libtiff/tif_aux.c (_TIFFCheckRealloc): Improve error message so
- * that it is clearly a memory allocation error message, and also
- * includes the size of the allocation request.
- *
- * Revision 1.13 2008/01/01 15:46:28 fwarmerdam
- * Changes to reflect the fact that TIFFFieldWithTag() and TIFFFieldWithName()
- * now return TIFFField pointers instead of TIFFFieldInfo pointers.
- *
- * Revision 1.12 2007/02/24 17:14:14 dron
- * Properly handle tags with TIFF_VARIABLE writecount. As per bug
- * http://bugzilla.remotesensing.org/show_bug.cgi?id=1350
- *
- * Revision 1.11 2005/09/13 14:13:42 dron
- * Avoid warnings.
- *
- * Revision 1.10 2005/02/24 14:47:11 fwarmerdam
- * Updated header.
- *
*/
@@ -86,7 +65,7 @@ GetField(TIFF *tiff, const char *tagname)
fip = TIFFFieldWithName(tiff, tagname);
if (!fip) {
- fprintf( stderr, "Field name %s not recognised.\n", tagname );
+ fprintf( stderr, "Field name \"%s\" is not recognised.\n", tagname );
return (TIFFField *)NULL;
}
@@ -230,7 +209,18 @@ main(int argc, char* argv[])
if (fip->field_passcount) {
ret = TIFFSetField(tiff, fip->field_tag,
wc, array);
- } else {
+ } else if (fip->field_tag == TIFFTAG_PAGENUMBER
+ || fip->field_tag == TIFFTAG_HALFTONEHINTS
+ || fip->field_tag == TIFFTAG_YCBCRSUBSAMPLING
+ || fip->field_tag == TIFFTAG_DOTRANGE) {
+ if (fip->field_type == TIFF_BYTE) {
+ ret = TIFFSetField(tiff, fip->field_tag,
+ ((uint8 *)array)[0], ((uint8 *)array)[1]);
+ } else if (fip->field_type == TIFF_SHORT) {
+ ret = TIFFSetField(tiff, fip->field_tag,
+ ((uint16 *)array)[0], ((uint16 *)array)[1]);
+ }
+ } else {
ret = TIFFSetField(tiff, fip->field_tag,
array);
}