Fix handling of -q values. (bug 587)

This commit is contained in:
Frank Warmerdam 2006-06-19 20:12:07 +00:00
parent 8a6eb4e9c4
commit 06ab41916f
2 changed files with 14 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2006-06-19 Frank Warmerdam <warmerdam@pobox.com>
* tools/tiff2pdf.c: Fix handling of -q values.
http://bugzilla.remotesensing.org/show_bug.cgi?id=587
2006-06-17 Frank Warmerdam <warmerdam@pobox.com>
* tif_readdir.c: Added case in EstimateStripByteCounts() for tiled

View File

@ -1,4 +1,4 @@
/* $Id: tiff2pdf.c,v 1.35 2006-06-08 11:27:11 dron Exp $
/* $Id: tiff2pdf.c,v 1.36 2006-06-19 20:12:08 fwarmerdam Exp $
*
* tiff2pdf - converts a TIFF image to a PDF document
*
@ -952,7 +952,7 @@ void t2p_validate(T2P* t2p){
#ifdef JPEG_SUPPORT
if(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){
if(t2p->pdf_defaultcompressionquality<100 ||
if(t2p->pdf_defaultcompressionquality>100 ||
t2p->pdf_defaultcompressionquality<1){
t2p->pdf_defaultcompressionquality=0;
}
@ -960,25 +960,17 @@ void t2p_validate(T2P* t2p){
#endif
#ifdef ZIP_SUPPORT
if(t2p->pdf_defaultcompression==T2P_COMPRESS_ZIP){
switch (t2p->pdf_defaultcompressionquality){
case 1: case 10: case 11: case 12: case 13: case 14: case 15:
case 101: case 110: case 111: case 112: case 113: case 114: case 115:
case 201: case 210: case 211: case 212: case 213: case 214: case 215:
case 301: case 310: case 311: case 312: case 313: case 314: case 315:
case 401: case 410: case 411: case 412: case 413: case 414: case 415:
case 501: case 510: case 511: case 512: case 513: case 514: case 515:
case 601: case 610: case 611: case 612: case 613: case 614: case 615:
case 701: case 710: case 711: case 712: case 713: case 714: case 715:
case 801: case 810: case 811: case 812: case 813: case 814: case 815:
case 901: case 910: case 911: case 912: case 913: case 914: case 915:
break;
default:
t2p->pdf_defaultcompressionquality=0;
uint16 m=t2p->pdf_defaultcompressionquality%100;
if(t2p->pdf_defaultcompressionquality/100 > 9 ||
(m>1 && m<10) || m>15){
t2p->pdf_defaultcompressionquality=0;
}
if(t2p->pdf_defaultcompressionquality%100 !=0){
t2p->pdf_defaultcompressionquality/=100;
t2p->pdf_defaultcompressionquality*=100;
TIFFError(
TIFF2PDF_MODULE,
"PNG Group predictor differencing not implemented, assuming compresion quality %u",
"PNG Group predictor differencing not implemented, assuming compression quality %u",
t2p->pdf_defaultcompressionquality);
}
t2p->pdf_defaultcompressionquality%=100;