37 static const char *photoNames[] = {
41 "palette color (RGB from colormap)",
48 #define NPHOTONAMES (sizeof (photoNames) / sizeof (photoNames[0])) 50 static const char *orientNames[] = {
52 "row 0 top, col 0 lhs",
53 "row 0 top, col 0 rhs",
54 "row 0 bottom, col 0 rhs",
55 "row 0 bottom, col 0 lhs",
56 "row 0 lhs, col 0 top",
57 "row 0 rhs, col 0 top",
58 "row 0 rhs, col 0 bottom",
59 "row 0 lhs, col 0 bottom",
61 #define NORIENTNAMES (sizeof (orientNames) / sizeof (orientNames[0])) 65 uint32 value_count,
void *raw_data)
71 for(j = 0; j < value_count; j++) {
73 fprintf(fd,
"%u", ((
uint8 *) raw_data)[j]);
76 (
unsigned int) ((
unsigned char *) raw_data)[j]);
78 fprintf(fd,
"%d", ((
int8 *) raw_data)[j]);
80 fprintf(fd,
"%u", ((
uint16 *) raw_data)[j]);
82 fprintf(fd,
"%d", ((
int16 *) raw_data)[j]);
85 (
unsigned long)((
uint32 *) raw_data)[j]);
87 fprintf(fd,
"%ld", (
long)((int32 *) raw_data)[j]);
91 fprintf(fd,
"%f", ((
float *) raw_data)[j]);
93 fprintf(fd,
"0x%ulx", ((
uint32 *) raw_data)[j]);
95 fprintf(fd,
"%s", (
char *) raw_data);
99 fprintf(fd,
"%f", ((
double *) raw_data)[j]);
101 fprintf(fd,
"%f", ((
float *)raw_data)[j]);
103 fprintf(fd,
"<unsupported data type in TIFFPrint>");
107 if(j < value_count - 1)
115 _TIFFPrettyPrintField(
TIFF* tif, FILE* fd,
ttag_t tag,
116 uint32 value_count,
void *raw_data)
123 fprintf(fd,
" Ink Set: ");
124 switch (*((
uint16*)raw_data)) {
126 fprintf(fd,
"CMYK\n");
129 fprintf(fd,
"%u (0x%x)\n",
136 fprintf(fd,
" Dot Range: %u-%u\n",
140 fprintf(fd,
" White Point: %g-%g\n",
141 ((
float *)raw_data)[0], ((
float *)raw_data)[1]);
return 1;
146 fprintf(fd,
" Reference Black/White:\n");
148 fprintf(fd,
" %2d: %5g %5g\n", i,
149 ((
float *)raw_data)[2*i+0],
150 ((
float *)raw_data)[2*i+1]);
157 fprintf(fd,
" XMLPacket (XMP Metadata):\n" );
158 for(i = 0; i < value_count; i++)
159 fputc(((
char *)raw_data)[i], fd);
169 " RichTIFFIPTC Data: <present>, %lu bytes\n",
170 (
unsigned long) value_count * 4);
173 fprintf(fd,
" Photoshop Data: <present>, %lu bytes\n",
174 (
unsigned long) value_count);
177 fprintf(fd,
" ICC Profile: <present>, %lu bytes\n",
178 (
unsigned long) value_count);
182 " Sample to Nits conversion factor: %.4e\n",
183 *((
double*)raw_data));
202 fprintf(fd,
"TIFF Directory at offset 0x%lx (%lu)\n",
205 fprintf(fd,
" Subfile Type:");
208 fprintf(fd,
"%sreduced-resolution image", sep);
212 fprintf(fd,
"%smulti-page document", sep);
216 fprintf(fd,
"%stransparency mask", sep);
217 fprintf(fd,
" (%lu = 0x%lx)\n",
221 fprintf(fd,
" Image Width: %lu Image Length: %lu",
224 fprintf(fd,
" Image Depth: %lu",
229 fprintf(fd,
" Tile Width: %lu Tile Length: %lu",
232 fprintf(fd,
" Tile Depth: %lu",
237 fprintf(fd,
" Resolution: %g, %g",
242 fprintf(fd,
" (unitless)");
245 fprintf(fd,
" pixels/inch");
248 fprintf(fd,
" pixels/cm");
251 fprintf(fd,
" (unit %u = 0x%x)",
260 fprintf(fd,
" Position: %g, %g\n",
265 fprintf(fd,
" Sample Format: ");
268 fprintf(fd,
"void\n");
271 fprintf(fd,
"signed integer\n");
274 fprintf(fd,
"unsigned integer\n");
277 fprintf(fd,
"IEEE floating point\n");
280 fprintf(fd,
"complex signed integer\n");
283 fprintf(fd,
"complex IEEE floating point\n");
286 fprintf(fd,
"%u (0x%x)\n",
293 fprintf(fd,
" Compression Scheme: ");
295 fprintf(fd,
"%s\n", c->
name);
297 fprintf(fd,
"%u (0x%x)\n",
301 fprintf(fd,
" Photometric Interpretation: ");
307 fprintf(fd,
"CIE Log2(L)\n");
310 fprintf(fd,
"CIE Log2(L) (u',v')\n");
313 fprintf(fd,
"%u (0x%x)\n",
325 fprintf(fd,
"%sunspecified", sep);
328 fprintf(fd,
"%sassoc-alpha", sep);
331 fprintf(fd,
"%sunassoc-alpha", sep);
334 fprintf(fd,
"%s%u (0x%x)", sep,
344 fprintf(fd,
" Ink Names: ");
347 for (cp = td->
td_inknames; i > 0; cp = strchr(cp,
'\0')+1, i--) {
355 fprintf(fd,
" Thresholding: ");
358 fprintf(fd,
"bilevel art scan\n");
361 fprintf(fd,
"halftone or dithered scan\n");
364 fprintf(fd,
"error diffused\n");
367 fprintf(fd,
"%u (0x%x)\n",
373 fprintf(fd,
" FillOrder: ");
376 fprintf(fd,
"msb-to-lsb\n");
379 fprintf(fd,
"lsb-to-msb\n");
382 fprintf(fd,
"%u (0x%x)\n",
397 subsampling + 0, subsampling + 1 );
398 fprintf(fd,
" YCbCr Subsampling: %u, %u\n",
399 subsampling[0], subsampling[1] );
402 fprintf(fd,
" YCbCr Positioning: ");
405 fprintf(fd,
"centered\n");
408 fprintf(fd,
"cosited\n");
411 fprintf(fd,
"%u (0x%x)\n",
417 fprintf(fd,
" Halftone Hints: light %u dark %u\n",
420 fprintf(fd,
" Orientation: ");
424 fprintf(fd,
"%u (0x%x)\n",
430 fprintf(fd,
" Rows/Strip: ");
432 fprintf(fd,
"(infinite)\n");
441 fprintf(fd,
" SMin Sample Value: %g\n",
444 fprintf(fd,
" SMax Sample Value: %g\n",
447 fprintf(fd,
" Planar Configuration: ");
450 fprintf(fd,
"single image plane\n");
453 fprintf(fd,
"separate image planes\n");
456 fprintf(fd,
"%u (0x%x)\n",
462 fprintf(fd,
" Page Number: %u-%u\n",
465 fprintf(fd,
" Color Map: ");
469 for (l = 0; l <
n; l++)
470 fprintf(fd,
" %5lu: %5u %5u %5u\n",
476 fprintf(fd,
"(present)\n");
479 fprintf(fd,
" Transfer Function: ");
483 for (l = 0; l <
n; l++) {
484 fprintf(fd,
" %2lu: %5u",
492 fprintf(fd,
"(present)\n");
495 fprintf(fd,
" SubIFD Offsets:");
497 fprintf(fd,
" %5lu", (
long) td->
td_subifd[i]);
509 for(i = 0; i <
count; i++) {
521 if(
TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
581 if (_TIFFPrettyPrintField(tif, fd, tag, value_count, raw_data)) {
587 _TIFFPrintField(fd, fip, value_count, raw_data);
600 fprintf(fd,
" %lu %s:\n",
602 isTiled(tif) ?
"Tiles" :
"Strips");
604 fprintf(fd,
" %3lu: [%8lu, %8lu]\n",
614 for (; *cp !=
'\0'; cp++) {
617 if (isprint((
int)*cp)) {
621 for (tp =
"\tt\bb\rr\nn\vv"; *tp; tp++)
625 fprintf(fd,
"\\%c", *tp);
627 fprintf(fd,
"\\%03o", *cp & 0xff);
634 fprintf(fd,
" %s: \"", name);
TIFFTagMethods tif_tagmethods
void _TIFFprintAscii(FILE *fd, const char *cp)
#define FIELD_MINSAMPLEVALUE
#define THRESHHOLD_ERRORDIFFUSE
#define TIFFTAG_ICCPROFILE
#define FIELD_STRIPOFFSETS
#define THRESHHOLD_BILEVEL
#define FIELD_IMAGEDIMENSIONS
#define FIELD_THRESHHOLDING
#define YCBCRPOSITION_COSITED
#define FILLORDER_LSB2MSB
uint16 * td_transferfunction[3]
void TIFFPrintDirectory(TIFF *tif, FILE *fd, long flags)
#define FIELD_HALFTONEHINTS
#define PHOTOMETRIC_LOGLUV
#define TIFFPRINT_COLORMAP
#define TIFFTAG_YCBCRSUBSAMPLING
#define FIELD_RESOLUTIONUNIT
#define TIFFTAG_REFERENCEBLACKWHITE
#define FIELD_YCBCRSUBSAMPLING
#define FIELD_SMAXSAMPLEVALUE
local void * mem_alloc(void *mem, unsigned count, unsigned size)
#define FIELD_TRANSFERFUNCTION
#define FIELD_MAXSAMPLEVALUE
#define FIELD_BITSPERSAMPLE
void _TIFFprintAsciiTag(FILE *fd, const char *name, const char *value)
#define YCBCRPOSITION_CENTERED
unsigned char field_passcount
#define FIELD_PLANARCONFIG
#define SAMPLEFORMAT_VOID
#define TIFFTAG_XMLPACKET
#define SAMPLEFORMAT_COMPLEXIEEEFP
#define SAMPLEFORMAT_UINT
#define RESUNIT_CENTIMETER
#define SAMPLEFORMAT_IEEEFP
#define TIFFTAG_HALFTONEHINTS
#define FIELD_PHOTOMETRIC
uint16 td_halftonehints[2]
#define EXTRASAMPLE_UNASSALPHA
#define TIFFFieldSet(tif, field)
#define TIFFTAG_PAGENUMBER
#define FIELD_COMPRESSION
#define FIELD_SMINSAMPLEVALUE
#define FIELD_ROWSPERSTRIP
ttag_t TIFFGetTagListEntry(TIFF *tif, int tag_index)
GLsizei const GLfloat * value
double td_smaxsamplevalue
#define TIFFTAG_WHITEPOINT
const TIFFCodec * TIFFFindCODEC(uint16 scheme)
#define FIELD_ORIENTATION
#define PLANARCONFIG_SEPARATE
#define FILETYPE_REDUCEDIMAGE
GLuint const GLchar * name
uint16 td_samplesperpixel
#define FIELD_YCBCRPOSITIONING
int _TIFFDataSize(TIFFDataType type)
#define FIELD_EXTRASAMPLES
double td_sminsamplevalue
uint16 td_ycbcrpositioning
int TIFFGetTagListCount(TIFF *tif)
#define EXTRASAMPLE_UNSPECIFIED
const TIFFFieldInfo * TIFFFieldWithTag(TIFF *, ttag_t)
#define FIELD_TILEDIMENSIONS
#define TIFFTAG_RICHTIFFIPTC
#define SAMPLEFORMAT_COMPLEXINT
void * _TIFFmalloc(tsize_t s)
GLuint GLuint GLsizei count
#define FIELD_SAMPLESPERPIXEL
int TIFFGetField(TIFF *tif, ttag_t tag,...)
void _TIFFfree(tdata_t p)
#define EXTRASAMPLE_ASSOCALPHA
#define FIELD_SAMPLEFORMAT
#define THRESHHOLD_HALFTONE
#define FILLORDER_MSB2LSB
#define TIFFTAG_PHOTOSHOP
#define PLANARCONFIG_CONTIG
#define FIELD_SUBFILETYPE
uint32 * td_stripbytecount