From 7a8485f2f56119c5d628a4cd1b8287dad7e5147e Mon Sep 17 00:00:00 2001 From: Andrey Kiselev Date: Thu, 26 Feb 2004 10:14:19 +0000 Subject: [PATCH] Copy JPEGTables tag contents for JPEG compressed images. Reported by Artem Mirolubov. --- tools/tiffsplit.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/tiffsplit.c b/tools/tiffsplit.c index cca3696a..c9734fa3 100644 --- a/tools/tiffsplit.c +++ b/tools/tiffsplit.c @@ -1,4 +1,4 @@ -/* $Header: /cvs/maptools/cvsroot/libtiff/tools/tiffsplit.c,v 1.4 2004-01-26 17:00:56 dron Exp $ */ +/* $Header: /cvs/maptools/cvsroot/libtiff/tools/tiffsplit.c,v 1.5 2004-02-26 10:14:19 dron Exp $ */ /* * Copyright (c) 1992-1997 Sam Leffler @@ -137,7 +137,7 @@ newfilename(void) static int tiffcp(TIFF* in, TIFF* out) { - short bitspersample, samplesperpixel, shortv, *shortav; + uint16 bitspersample, samplesperpixel, compression, shortv, *shortav; uint32 w, l; float floatv; char *stringv; @@ -149,13 +149,18 @@ tiffcp(TIFF* in, TIFF* out) CopyField(TIFFTAG_IMAGEWIDTH, w); CopyField(TIFFTAG_IMAGELENGTH, l); CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample); - CopyField(TIFFTAG_COMPRESSION, shortv); + CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); + CopyField(TIFFTAG_COMPRESSION, compression); + if (compression == COMPRESSION_JPEG) { + uint16 count; + void *table; + TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table); + TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table); + } CopyField(TIFFTAG_PREDICTOR, shortv); - CopyField(TIFFTAG_PHOTOMETRIC, shortv); CopyField(TIFFTAG_THRESHHOLDING, shortv); CopyField(TIFFTAG_FILLORDER, shortv); CopyField(TIFFTAG_ORIENTATION, shortv); - CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); CopyField(TIFFTAG_MINSAMPLEVALUE, shortv); CopyField(TIFFTAG_MAXSAMPLEVALUE, shortv); CopyField(TIFFTAG_XRESOLUTION, floatv);