Added possibility to specify value -1 to -r option to get the entire image

as one strip. See http://bugzilla.remotesensing.org/show_bug.cgi?id=343
for details.
This commit is contained in:
Andrey Kiselev 2003-06-10 06:15:36 +00:00
parent 911529dced
commit 2f4d3521b4
2 changed files with 18 additions and 10 deletions

View File

@ -1,4 +1,4 @@
.\" $Header: /cvs/maptools/cvsroot/libtiff/man/tiffcp.1,v 1.3 2001-02-19 15:20:54 warmerda Exp $
.\" $Header: /cvs/maptools/cvsroot/libtiff/man/tiffcp.1,v 1.4 2003-06-10 06:15:36 dron Exp $
.\"
.\" Copyright (c) 1988-1997 Sam Leffler
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
@ -178,10 +178,16 @@ will force samples to be written in separate planes.
.B \-r
Specify the number of rows (scanlines) in each strip of data
written to the output file.
By default,
By default (or when value
.B 0
is specified),
.I tiffcp
attempts to set the rows/strip
that no more than 8 kilobytes of data appear in a strip.
that no more than 8 kilobytes of data appear in a strip. If you specify
special value
.B -1
it will results in infinite number of the rows per strip. The entire image
will be the one strip in that case.
.TP
.B \-s
Force the output file to be written with data organized in strips

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/tools/tiffcp.c,v 1.12 2003-06-04 10:36:54 dron Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/tools/tiffcp.c,v 1.13 2003-06-10 06:15:36 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -149,7 +149,7 @@ main(int argc, char* argv[])
uint16 deffillorder = 0;
uint32 deftilewidth = (uint32) -1;
uint32 deftilelength = (uint32) -1;
uint32 defrowsperstrip = (uint32) -1;
uint32 defrowsperstrip = (uint32) 0;
uint32 diroff = 0;
TIFF* in;
TIFF* out;
@ -528,11 +528,11 @@ tiffcp(TIFF* in, TIFF* out)
uint16 bitspersample, samplesperpixel;
uint16 input_compression;
copyFunc cf;
uint32 w, l;
uint32 width, length;
struct cpTag* p;
CopyField(TIFFTAG_IMAGEWIDTH, w);
CopyField(TIFFTAG_IMAGELENGTH, l);
CopyField(TIFFTAG_IMAGEWIDTH, width);
CopyField(TIFFTAG_IMAGELENGTH, length);
CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);
CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
if (compression != (uint16)-1)
@ -610,11 +610,13 @@ tiffcp(TIFF* in, TIFF* out)
* value from the input image or, if nothing is defined,
* use the library default.
*/
if (rowsperstrip == (uint32) -1) {
if (rowsperstrip == (uint32) 0) {
if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP,&rowsperstrip))
rowsperstrip =
TIFFDefaultStripSize(out, rowsperstrip);
}
else if (rowsperstrip == (uint32) -1)
rowsperstrip = length;
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
}
if (config != (uint16) -1)
@ -672,7 +674,7 @@ tiffcp(TIFF* in, TIFF* out)
CopyTag(p->tag, p->count, p->type);
cf = pickCopyFunc(in, out, bitspersample, samplesperpixel);
return (cf ? (*cf)(in, out, l, w, samplesperpixel) : FALSE);
return (cf ? (*cf)(in, out, length, width, samplesperpixel) : FALSE);
}
/*