about summary refs log tree commit diff
path: root/converter/other/pnmtotiffcmyk.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-03-19 15:35:43 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-03-19 15:35:43 +0000
commit8ceb5fdeab52e44fc6cdacae6aa7d7eec009bc18 (patch)
treebf9e81ee47830138a69149274dbf5dbabf32e0f4 /converter/other/pnmtotiffcmyk.c
parentbafd5aa45a664883d58810ae49c0aa2d36c3e12e (diff)
downloadnetpbm-mirror-8ceb5fdeab52e44fc6cdacae6aa7d7eec009bc18.tar.gz
netpbm-mirror-8ceb5fdeab52e44fc6cdacae6aa7d7eec009bc18.tar.xz
netpbm-mirror-8ceb5fdeab52e44fc6cdacae6aa7d7eec009bc18.zip
Use TIFFDefaultStripSize() for ROWSPERSTRIP default; old calculation sometimes yields invalid zero
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2921 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pnmtotiffcmyk.c')
-rw-r--r--converter/other/pnmtotiffcmyk.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/converter/other/pnmtotiffcmyk.c b/converter/other/pnmtotiffcmyk.c
index 2e6ae935..b7e3228e 100644
--- a/converter/other/pnmtotiffcmyk.c
+++ b/converter/other/pnmtotiffcmyk.c
@@ -540,7 +540,6 @@ tiffOpen( Out* out, Root *r ) {
   short samplesperpixel = 4 ; /* cmyk has four values */
   uint16 bitspersample = MAXTIFFBITS ;
   short photometric = PHOTOMETRIC_SEPARATED ; /* ie cmyk */
-  int bytesperrow = r->nCols ;
 
   t->tiff = TIFFFdOpen( 1, "Standard Output", "w" ) ;
   if ( ! t->tiff ) {
@@ -548,11 +547,6 @@ tiffOpen( Out* out, Root *r ) {
     return ERR_TIFF ;
   }
 
-  /* from pnmtotiff - default is to have 8kb strips */
-  if ( ! t->rowsperstrip ) {
-    t->rowsperstrip = ( 8 * 1024 ) / bytesperrow ;
-  }
-
   TIFFSetField( t->tiff, TIFFTAG_DOTRANGE, t->lowdotrange, t->highdotrange ) ;
   TIFFSetField( t->tiff, TIFFTAG_IMAGEWIDTH, (uint32)r->nCols ) ;
   TIFFSetField( t->tiff, TIFFTAG_IMAGELENGTH, (uint32)r->nRows ) ;
@@ -567,6 +561,9 @@ tiffOpen( Out* out, Root *r ) {
   TIFFSetField( t->tiff, TIFFTAG_DOCUMENTNAME, r->name ) ;
   TIFFSetField( t->tiff, TIFFTAG_IMAGEDESCRIPTION, "PNM -> CMYK tiff" ) ;
   TIFFSetField( t->tiff, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel ) ;
+  if ( t->rowsperstrip == 0) {
+    t->rowsperstrip = TIFFDefaultStripSize(t->tiff, 0) ;
+  }
   TIFFSetField( t->tiff, TIFFTAG_ROWSPERSTRIP, t->rowsperstrip ) ;
   TIFFSetField( t->tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG ) ;