summaryrefslogtreecommitdiff
path: root/tools/tiff2ps.c
diff options
context:
space:
mode:
authorSam Leffler <sam@engr.sgi.com>1997-09-01 03:22:05 +0100
committerRoger Leigh <rleigh@codelibre.net>2022-06-22 19:41:27 +0100
commit0db24a4dc6b63cb897d1179d5e0a639707ab6868 (patch)
tree58f3974d5cde95e12b6df96d8e35c83bd3fc0798 /tools/tiff2ps.c
parent7b7dc6a9696b7d7fb1c2fcdd355ee0e3a9d22c2d (diff)
downloadlibtiff-git-tiff-3.4.tar.gz
v3.4beta037 releasev3.4beta037tiff-3.4
Diffstat (limited to 'tools/tiff2ps.c')
-rw-r--r--tools/tiff2ps.c55
1 files changed, 38 insertions, 17 deletions
diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c
index 2ceab788..b0f0d032 100644
--- a/tools/tiff2ps.c
+++ b/tools/tiff2ps.c
@@ -1,8 +1,8 @@
-/* $Header: /usr/people/sam/tiff/tools/RCS/tiff2ps.c,v 1.51 1997/02/20 20:15:03 sam Exp $ */
+/* $Header: /d1/sam/tiff/tools/RCS/tiff2ps.c,v 1.53 1997/08/29 21:46:51 sam Exp $ */
/*
- * Copyright (c) 1988-1996 Sam Leffler
- * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
@@ -174,15 +174,6 @@ static int alpha;
static int
checkImage(TIFF* tif)
{
- switch (bitspersample) {
- case 1: case 2:
- case 4: case 8:
- break;
- default:
- TIFFError(filename, "Can not handle %d-bit/sample image",
- bitspersample);
- return (0);
- }
switch (photometric) {
case PHOTOMETRIC_YCBCR:
if (compression == COMPRESSION_JPEG &&
@@ -212,6 +203,23 @@ checkImage(TIFF* tif)
case PHOTOMETRIC_MINISBLACK:
case PHOTOMETRIC_MINISWHITE:
break;
+ case PHOTOMETRIC_LOGL:
+ case PHOTOMETRIC_LOGLUV:
+ if (compression != COMPRESSION_SGILOG &&
+ compression != COMPRESSION_SGILOG24) {
+ TIFFError(filename,
+ "Can not handle %s data with compression other than SGILog",
+ (photometric == PHOTOMETRIC_LOGL) ?
+ "LogL" : "LogLuv"
+ );
+ return (0);
+ }
+ /* rely on library to convert to RGB/greyscale */
+ TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
+ photometric = (photometric == PHOTOMETRIC_LOGL) ?
+ PHOTOMETRIC_MINISBLACK : PHOTOMETRIC_RGB;
+ bitspersample = 8;
+ break;
case PHOTOMETRIC_CIELAB:
/* fall thru... */
default:
@@ -220,6 +228,15 @@ checkImage(TIFF* tif)
photometric);
return (0);
}
+ switch (bitspersample) {
+ case 1: case 2:
+ case 4: case 8:
+ break;
+ default:
+ TIFFError(filename, "Can not handle %d-bit/sample image",
+ bitspersample);
+ return (0);
+ }
if (planarconfiguration == PLANARCONFIG_SEPARATE && extrasamples > 0)
TIFFWarning(filename, "Ignoring extra samples");
return (1);
@@ -336,7 +353,6 @@ TIFF2PS(FILE* fd, TIFF* tif, float pw, float ph)
setupPageState(tif, &w, &h, &prw, &prh);
if (!npages)
PSHead(fd, tif, w, h, prw, prh, ox, oy);
- tf_bytesperrow = TIFFScanlineSize(tif);
TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE,
&bitspersample);
TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL,
@@ -362,6 +378,7 @@ TIFF2PS(FILE* fd, TIFF* tif, float pw, float ph)
}
}
if (checkImage(tif)) {
+ tf_bytesperrow = TIFFScanlineSize(tif);
npages++;
fprintf(fd, "%%%%Page: %d %d\n", npages, npages);
fprintf(fd, "gsave\n");
@@ -688,7 +705,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
use_rawdata = TRUE;
switch (compression) {
- case COMPRESSION_NONE: /* 1: uncompressed */
+ case COMPRESSION_NONE: /* 1: uncompressed */
break;
case COMPRESSION_CCITTRLE: /* 2: CCITT modified Huffman RLE */
case COMPRESSION_CCITTRLEW: /* 32771: #1 w/ word alignment */
@@ -746,12 +763,12 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
}
fputs(" /LZWDecode filter", fd);
break;
- case COMPRESSION_PACKBITS: /* 32773: Macintosh RLE */
+ case COMPRESSION_PACKBITS: /* 32773: Macintosh RLE */
fputs(" /RunLengthDecode filter", fd);
use_rawdata = TRUE;
break;
- case COMPRESSION_OJPEG: /* 6: !6.0 JPEG */
- case COMPRESSION_JPEG: /* 7: %JPEG DCT compression */
+ case COMPRESSION_OJPEG: /* 6: !6.0 JPEG */
+ case COMPRESSION_JPEG: /* 7: %JPEG DCT compression */
#ifdef notdef
/*
* Code not tested yet
@@ -769,6 +786,10 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
case COMPRESSION_JBIG: /* 34661: ISO JBIG */
use_rawdata = FALSE;
break;
+ case COMPRESSION_SGILOG: /* 34676: SGI LogL or LogLuv */
+ case COMPRESSION_SGILOG24: /* 34677: SGI 24-bit LogLuv */
+ use_rawdata = FALSE;
+ break;
default:
/*
* ERROR...