1
/* $Id: tif_print.c,v 1.59 2012-06-13 01:08:51 fwarmerdam Exp $ */
4
* Copyright (c) 1988-1997 Sam Leffler
5
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
7
* Permission to use, copy, modify, distribute, and sell this software and
8
* its documentation for any purpose is hereby granted without fee, provided
9
* that (i) the above copyright notices and this permission notice appear in
10
* all copies of the software and related documentation, and (ii) the names of
11
* Sam Leffler and Silicon Graphics may not be used in any advertising or
12
* publicity relating to the software without the specific, prior written
13
* permission of Sam Leffler and Silicon Graphics.
15
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
30
* Directory Printing Support
38
_TIFFprintAsciiBounded(FILE* fd, const char* cp, int max_chars);
40
static const char *photoNames[] = {
41
"min-is-white", /* PHOTOMETRIC_MINISWHITE */
42
"min-is-black", /* PHOTOMETRIC_MINISBLACK */
43
"RGB color", /* PHOTOMETRIC_RGB */
44
"palette color (RGB from colormap)", /* PHOTOMETRIC_PALETTE */
45
"transparency mask", /* PHOTOMETRIC_MASK */
46
"separated", /* PHOTOMETRIC_SEPARATED */
47
"YCbCr", /* PHOTOMETRIC_YCBCR */
49
"CIE L*a*b*", /* PHOTOMETRIC_CIELAB */
51
#define NPHOTONAMES (sizeof (photoNames) / sizeof (photoNames[0]))
53
static const char *orientNames[] = {
55
"row 0 top, col 0 lhs", /* ORIENTATION_TOPLEFT */
56
"row 0 top, col 0 rhs", /* ORIENTATION_TOPRIGHT */
57
"row 0 bottom, col 0 rhs", /* ORIENTATION_BOTRIGHT */
58
"row 0 bottom, col 0 lhs", /* ORIENTATION_BOTLEFT */
59
"row 0 lhs, col 0 top", /* ORIENTATION_LEFTTOP */
60
"row 0 rhs, col 0 top", /* ORIENTATION_RIGHTTOP */
61
"row 0 rhs, col 0 bottom", /* ORIENTATION_RIGHTBOT */
62
"row 0 lhs, col 0 bottom", /* ORIENTATION_LEFTBOT */
64
#define NORIENTNAMES (sizeof (orientNames) / sizeof (orientNames[0]))
67
_TIFFPrintField(FILE* fd, const TIFFField *fip,
68
uint32 value_count, void *raw_data)
72
fprintf(fd, " %s: ", fip->field_name);
74
for(j = 0; j < value_count; j++) {
75
if(fip->field_type == TIFF_BYTE)
76
fprintf(fd, "%u", ((uint8 *) raw_data)[j]);
77
else if(fip->field_type == TIFF_UNDEFINED)
79
(unsigned int) ((unsigned char *) raw_data)[j]);
80
else if(fip->field_type == TIFF_SBYTE)
81
fprintf(fd, "%d", ((int8 *) raw_data)[j]);
82
else if(fip->field_type == TIFF_SHORT)
83
fprintf(fd, "%u", ((uint16 *) raw_data)[j]);
84
else if(fip->field_type == TIFF_SSHORT)
85
fprintf(fd, "%d", ((int16 *) raw_data)[j]);
86
else if(fip->field_type == TIFF_LONG)
88
(unsigned long)((uint32 *) raw_data)[j]);
89
else if(fip->field_type == TIFF_SLONG)
90
fprintf(fd, "%ld", (long)((int32 *) raw_data)[j]);
91
else if(fip->field_type == TIFF_IFD)
93
(unsigned long)((uint32 *) raw_data)[j]);
94
else if(fip->field_type == TIFF_RATIONAL
95
|| fip->field_type == TIFF_SRATIONAL
96
|| fip->field_type == TIFF_FLOAT)
97
fprintf(fd, "%f", ((float *) raw_data)[j]);
98
else if(fip->field_type == TIFF_LONG8)
99
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
101
(unsigned __int64)((uint64 *) raw_data)[j]);
104
(unsigned long long)((uint64 *) raw_data)[j]);
106
else if(fip->field_type == TIFF_SLONG8)
107
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
108
fprintf(fd, "%I64d", (__int64)((int64 *) raw_data)[j]);
110
fprintf(fd, "%lld", (long long)((int64 *) raw_data)[j]);
112
else if(fip->field_type == TIFF_IFD8)
113
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
114
fprintf(fd, "0x%I64x",
115
(unsigned __int64)((uint64 *) raw_data)[j]);
117
fprintf(fd, "0x%llx",
118
(unsigned long long)((uint64 *) raw_data)[j]);
120
else if(fip->field_type == TIFF_FLOAT)
121
fprintf(fd, "%f", ((float *)raw_data)[j]);
122
else if(fip->field_type == TIFF_DOUBLE)
123
fprintf(fd, "%f", ((double *) raw_data)[j]);
124
else if(fip->field_type == TIFF_ASCII) {
125
fprintf(fd, "%s", (char *) raw_data);
129
fprintf(fd, "<unsupported data type in TIFFPrint>");
133
if(j < value_count - 1)
141
_TIFFPrettyPrintField(TIFF* tif, const TIFFField *fip, FILE* fd, uint32 tag,
142
uint32 value_count, void *raw_data)
146
/* do not try to pretty print auto-defined fields */
147
if (strncmp(fip->field_name,"Tag ", 4) == 0) {
154
if (value_count == 2 && fip->field_type == TIFF_SHORT) {
155
fprintf(fd, " Ink Set: ");
156
switch (*((uint16*)raw_data)) {
158
fprintf(fd, "CMYK\n");
161
fprintf(fd, "%u (0x%x)\n",
162
*((uint16*)raw_data),
163
*((uint16*)raw_data));
170
case TIFFTAG_DOTRANGE:
171
if (value_count == 2 && fip->field_type == TIFF_SHORT) {
172
fprintf(fd, " Dot Range: %u-%u\n",
173
((uint16*)raw_data)[0], ((uint16*)raw_data)[1]);
178
case TIFFTAG_WHITEPOINT:
179
if (value_count == 2 && fip->field_type == TIFF_RATIONAL) {
180
fprintf(fd, " White Point: %g-%g\n",
181
((float *)raw_data)[0], ((float *)raw_data)[1]);
186
case TIFFTAG_XMLPACKET:
190
fprintf(fd, " XMLPacket (XMP Metadata):\n" );
191
for(i = 0; i < value_count; i++)
192
fputc(((char *)raw_data)[i], fd);
196
case TIFFTAG_RICHTIFFIPTC:
198
* XXX: for some weird reason RichTIFFIPTC tag
199
* defined as array of LONG values.
202
" RichTIFFIPTC Data: <present>, %lu bytes\n",
203
(unsigned long) value_count * 4);
206
case TIFFTAG_PHOTOSHOP:
207
fprintf(fd, " Photoshop Data: <present>, %lu bytes\n",
208
(unsigned long) value_count);
211
case TIFFTAG_ICCPROFILE:
212
fprintf(fd, " ICC Profile: <present>, %lu bytes\n",
213
(unsigned long) value_count);
216
case TIFFTAG_STONITS:
217
if (value_count == 1 && fip->field_type == TIFF_DOUBLE) {
219
" Sample to Nits conversion factor: %.4e\n",
220
*((double*)raw_data));
230
* Print the contents of the current directory
231
* to the specified stdio file stream.
234
TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
236
TIFFDirectory *td = &tif->tif_dir;
241
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
242
fprintf(fd, "TIFF Directory at offset 0x%I64x (%I64u)\n",
243
(unsigned __int64) tif->tif_diroff,
244
(unsigned __int64) tif->tif_diroff);
246
fprintf(fd, "TIFF Directory at offset 0x%llx (%llu)\n",
247
(unsigned long long) tif->tif_diroff,
248
(unsigned long long) tif->tif_diroff);
250
if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) {
251
fprintf(fd, " Subfile Type:");
253
if (td->td_subfiletype & FILETYPE_REDUCEDIMAGE) {
254
fprintf(fd, "%sreduced-resolution image", sep);
257
if (td->td_subfiletype & FILETYPE_PAGE) {
258
fprintf(fd, "%smulti-page document", sep);
261
if (td->td_subfiletype & FILETYPE_MASK)
262
fprintf(fd, "%stransparency mask", sep);
263
fprintf(fd, " (%lu = 0x%lx)\n",
264
(long) td->td_subfiletype, (long) td->td_subfiletype);
266
if (TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS)) {
267
fprintf(fd, " Image Width: %lu Image Length: %lu",
268
(unsigned long) td->td_imagewidth, (unsigned long) td->td_imagelength);
269
if (TIFFFieldSet(tif,FIELD_IMAGEDEPTH))
270
fprintf(fd, " Image Depth: %lu",
271
(unsigned long) td->td_imagedepth);
274
if (TIFFFieldSet(tif,FIELD_TILEDIMENSIONS)) {
275
fprintf(fd, " Tile Width: %lu Tile Length: %lu",
276
(unsigned long) td->td_tilewidth, (unsigned long) td->td_tilelength);
277
if (TIFFFieldSet(tif,FIELD_TILEDEPTH))
278
fprintf(fd, " Tile Depth: %lu",
279
(unsigned long) td->td_tiledepth);
282
if (TIFFFieldSet(tif,FIELD_RESOLUTION)) {
283
fprintf(fd, " Resolution: %g, %g",
284
td->td_xresolution, td->td_yresolution);
285
if (TIFFFieldSet(tif,FIELD_RESOLUTIONUNIT)) {
286
switch (td->td_resolutionunit) {
288
fprintf(fd, " (unitless)");
291
fprintf(fd, " pixels/inch");
293
case RESUNIT_CENTIMETER:
294
fprintf(fd, " pixels/cm");
297
fprintf(fd, " (unit %u = 0x%x)",
298
td->td_resolutionunit,
299
td->td_resolutionunit);
305
if (TIFFFieldSet(tif,FIELD_POSITION))
306
fprintf(fd, " Position: %g, %g\n",
307
td->td_xposition, td->td_yposition);
308
if (TIFFFieldSet(tif,FIELD_BITSPERSAMPLE))
309
fprintf(fd, " Bits/Sample: %u\n", td->td_bitspersample);
310
if (TIFFFieldSet(tif,FIELD_SAMPLEFORMAT)) {
311
fprintf(fd, " Sample Format: ");
312
switch (td->td_sampleformat) {
313
case SAMPLEFORMAT_VOID:
314
fprintf(fd, "void\n");
316
case SAMPLEFORMAT_INT:
317
fprintf(fd, "signed integer\n");
319
case SAMPLEFORMAT_UINT:
320
fprintf(fd, "unsigned integer\n");
322
case SAMPLEFORMAT_IEEEFP:
323
fprintf(fd, "IEEE floating point\n");
325
case SAMPLEFORMAT_COMPLEXINT:
326
fprintf(fd, "complex signed integer\n");
328
case SAMPLEFORMAT_COMPLEXIEEEFP:
329
fprintf(fd, "complex IEEE floating point\n");
332
fprintf(fd, "%u (0x%x)\n",
333
td->td_sampleformat, td->td_sampleformat);
337
if (TIFFFieldSet(tif,FIELD_COMPRESSION)) {
338
const TIFFCodec* c = TIFFFindCODEC(td->td_compression);
339
fprintf(fd, " Compression Scheme: ");
341
fprintf(fd, "%s\n", c->name);
343
fprintf(fd, "%u (0x%x)\n",
344
td->td_compression, td->td_compression);
346
if (TIFFFieldSet(tif,FIELD_PHOTOMETRIC)) {
347
fprintf(fd, " Photometric Interpretation: ");
348
if (td->td_photometric < NPHOTONAMES)
349
fprintf(fd, "%s\n", photoNames[td->td_photometric]);
351
switch (td->td_photometric) {
352
case PHOTOMETRIC_LOGL:
353
fprintf(fd, "CIE Log2(L)\n");
355
case PHOTOMETRIC_LOGLUV:
356
fprintf(fd, "CIE Log2(L) (u',v')\n");
359
fprintf(fd, "%u (0x%x)\n",
360
td->td_photometric, td->td_photometric);
365
if (TIFFFieldSet(tif,FIELD_EXTRASAMPLES) && td->td_extrasamples) {
366
fprintf(fd, " Extra Samples: %u<", td->td_extrasamples);
368
for (i = 0; i < td->td_extrasamples; i++) {
369
switch (td->td_sampleinfo[i]) {
370
case EXTRASAMPLE_UNSPECIFIED:
371
fprintf(fd, "%sunspecified", sep);
373
case EXTRASAMPLE_ASSOCALPHA:
374
fprintf(fd, "%sassoc-alpha", sep);
376
case EXTRASAMPLE_UNASSALPHA:
377
fprintf(fd, "%sunassoc-alpha", sep);
380
fprintf(fd, "%s%u (0x%x)", sep,
381
td->td_sampleinfo[i], td->td_sampleinfo[i]);
388
if (TIFFFieldSet(tif,FIELD_INKNAMES)) {
390
fprintf(fd, " Ink Names: ");
391
i = td->td_samplesperpixel;
393
for (cp = td->td_inknames;
394
i > 0 && cp < td->td_inknames + td->td_inknameslen;
395
cp = strchr(cp,'\0')+1, i--) {
397
td->td_inknameslen - (cp - td->td_inknames);
399
_TIFFprintAsciiBounded(fd, cp, max_chars);
404
if (TIFFFieldSet(tif,FIELD_THRESHHOLDING)) {
405
fprintf(fd, " Thresholding: ");
406
switch (td->td_threshholding) {
407
case THRESHHOLD_BILEVEL:
408
fprintf(fd, "bilevel art scan\n");
410
case THRESHHOLD_HALFTONE:
411
fprintf(fd, "halftone or dithered scan\n");
413
case THRESHHOLD_ERRORDIFFUSE:
414
fprintf(fd, "error diffused\n");
417
fprintf(fd, "%u (0x%x)\n",
418
td->td_threshholding, td->td_threshholding);
422
if (TIFFFieldSet(tif,FIELD_FILLORDER)) {
423
fprintf(fd, " FillOrder: ");
424
switch (td->td_fillorder) {
425
case FILLORDER_MSB2LSB:
426
fprintf(fd, "msb-to-lsb\n");
428
case FILLORDER_LSB2MSB:
429
fprintf(fd, "lsb-to-msb\n");
432
fprintf(fd, "%u (0x%x)\n",
433
td->td_fillorder, td->td_fillorder);
437
if (TIFFFieldSet(tif,FIELD_YCBCRSUBSAMPLING))
439
fprintf(fd, " YCbCr Subsampling: %u, %u\n",
440
td->td_ycbcrsubsampling[0], td->td_ycbcrsubsampling[1] );
442
if (TIFFFieldSet(tif,FIELD_YCBCRPOSITIONING)) {
443
fprintf(fd, " YCbCr Positioning: ");
444
switch (td->td_ycbcrpositioning) {
445
case YCBCRPOSITION_CENTERED:
446
fprintf(fd, "centered\n");
448
case YCBCRPOSITION_COSITED:
449
fprintf(fd, "cosited\n");
452
fprintf(fd, "%u (0x%x)\n",
453
td->td_ycbcrpositioning, td->td_ycbcrpositioning);
457
if (TIFFFieldSet(tif,FIELD_HALFTONEHINTS))
458
fprintf(fd, " Halftone Hints: light %u dark %u\n",
459
td->td_halftonehints[0], td->td_halftonehints[1]);
460
if (TIFFFieldSet(tif,FIELD_ORIENTATION)) {
461
fprintf(fd, " Orientation: ");
462
if (td->td_orientation < NORIENTNAMES)
463
fprintf(fd, "%s\n", orientNames[td->td_orientation]);
465
fprintf(fd, "%u (0x%x)\n",
466
td->td_orientation, td->td_orientation);
468
if (TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))
469
fprintf(fd, " Samples/Pixel: %u\n", td->td_samplesperpixel);
470
if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) {
471
fprintf(fd, " Rows/Strip: ");
472
if (td->td_rowsperstrip == (uint32) -1)
473
fprintf(fd, "(infinite)\n");
475
fprintf(fd, "%lu\n", (unsigned long) td->td_rowsperstrip);
477
if (TIFFFieldSet(tif,FIELD_MINSAMPLEVALUE))
478
fprintf(fd, " Min Sample Value: %u\n", td->td_minsamplevalue);
479
if (TIFFFieldSet(tif,FIELD_MAXSAMPLEVALUE))
480
fprintf(fd, " Max Sample Value: %u\n", td->td_maxsamplevalue);
481
if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE)) {
482
int count = (tif->tif_flags & TIFF_PERSAMPLE) ? td->td_samplesperpixel : 1;
483
fprintf(fd, " SMin Sample Value:");
484
for (i = 0; i < count; ++i)
485
fprintf(fd, " %g", td->td_sminsamplevalue[i]);
488
if (TIFFFieldSet(tif,FIELD_SMAXSAMPLEVALUE)) {
489
int count = (tif->tif_flags & TIFF_PERSAMPLE) ? td->td_samplesperpixel : 1;
490
fprintf(fd, " SMax Sample Value:");
491
for (i = 0; i < count; ++i)
492
fprintf(fd, " %g", td->td_smaxsamplevalue[i]);
495
if (TIFFFieldSet(tif,FIELD_PLANARCONFIG)) {
496
fprintf(fd, " Planar Configuration: ");
497
switch (td->td_planarconfig) {
498
case PLANARCONFIG_CONTIG:
499
fprintf(fd, "single image plane\n");
501
case PLANARCONFIG_SEPARATE:
502
fprintf(fd, "separate image planes\n");
505
fprintf(fd, "%u (0x%x)\n",
506
td->td_planarconfig, td->td_planarconfig);
510
if (TIFFFieldSet(tif,FIELD_PAGENUMBER))
511
fprintf(fd, " Page Number: %u-%u\n",
512
td->td_pagenumber[0], td->td_pagenumber[1]);
513
if (TIFFFieldSet(tif,FIELD_COLORMAP)) {
514
fprintf(fd, " Color Map: ");
515
if (flags & TIFFPRINT_COLORMAP) {
517
n = 1L<<td->td_bitspersample;
518
for (l = 0; l < n; l++)
519
fprintf(fd, " %5lu: %5u %5u %5u\n",
521
td->td_colormap[0][l],
522
td->td_colormap[1][l],
523
td->td_colormap[2][l]);
525
fprintf(fd, "(present)\n");
527
if (TIFFFieldSet(tif,FIELD_REFBLACKWHITE)) {
528
fprintf(fd, " Reference Black/White:\n");
529
for (i = 0; i < 3; i++)
530
fprintf(fd, " %2d: %5g %5g\n", i,
531
td->td_refblackwhite[2*i+0],
532
td->td_refblackwhite[2*i+1]);
534
if (TIFFFieldSet(tif,FIELD_TRANSFERFUNCTION)) {
535
fprintf(fd, " Transfer Function: ");
536
if (flags & TIFFPRINT_CURVES) {
538
n = 1L<<td->td_bitspersample;
539
for (l = 0; l < n; l++) {
540
fprintf(fd, " %2lu: %5u",
541
l, td->td_transferfunction[0][l]);
542
for (i = 1; i < td->td_samplesperpixel; i++)
544
td->td_transferfunction[i][l]);
548
fprintf(fd, "(present)\n");
550
if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) {
551
fprintf(fd, " SubIFD Offsets:");
552
for (i = 0; i < td->td_nsubifd; i++)
553
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
554
fprintf(fd, " %5I64u",
555
(unsigned __int64) td->td_subifd[i]);
557
fprintf(fd, " %5llu",
558
(unsigned long long) td->td_subifd[i]);
564
** Custom tag support.
570
count = (short) TIFFGetTagListCount(tif);
571
for(i = 0; i < count; i++) {
572
uint32 tag = TIFFGetTagListEntry(tif, i);
573
const TIFFField *fip;
578
fip = TIFFFieldWithTag(tif, tag);
582
if(fip->field_passcount) {
583
if (fip->field_readcount == TIFF_VARIABLE2 ) {
584
if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
586
} else if (fip->field_readcount == TIFF_VARIABLE2 ) {
587
uint16 small_value_count;
588
if(TIFFGetField(tif, tag, &small_value_count, &raw_data) != 1)
590
value_count = small_value_count;
592
assert (fip->field_readcount == TIFF_VARIABLE
593
|| fip->field_readcount == TIFF_VARIABLE2);
597
if (fip->field_readcount == TIFF_VARIABLE
598
|| fip->field_readcount == TIFF_VARIABLE2)
600
else if (fip->field_readcount == TIFF_SPP)
601
value_count = td->td_samplesperpixel;
603
value_count = fip->field_readcount;
604
if (fip->field_tag == TIFFTAG_DOTRANGE
605
&& strcmp(fip->field_name,"DotRange") == 0) {
606
/* TODO: This is an evil exception and should not have been
607
handled this way ... likely best if we move it into
608
the directory structure with an explicit field in
609
libtiff 4.1 and assign it a FIELD_ value */
610
static uint16 dotrange[2];
612
TIFFGetField(tif, tag, dotrange+0, dotrange+1);
613
} else if (fip->field_type == TIFF_ASCII
614
|| fip->field_readcount == TIFF_VARIABLE
615
|| fip->field_readcount == TIFF_VARIABLE2
616
|| fip->field_readcount == TIFF_SPP
617
|| value_count > 1) {
618
if(TIFFGetField(tif, tag, &raw_data) != 1)
621
raw_data = _TIFFmalloc(
622
_TIFFDataSize(fip->field_type)
625
if(TIFFGetField(tif, tag, raw_data) != 1) {
633
* Catch the tags which needs to be specially handled
634
* and pretty print them. If tag not handled in
635
* _TIFFPrettyPrintField() fall down and print it as
638
if (!_TIFFPrettyPrintField(tif, fip, fd, tag, value_count, raw_data))
639
_TIFFPrintField(fd, fip, value_count, raw_data);
646
if (tif->tif_tagmethods.printdir)
647
(*tif->tif_tagmethods.printdir)(tif, fd, flags);
649
_TIFFFillStriles( tif );
651
if ((flags & TIFFPRINT_STRIPS) &&
652
TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) {
655
fprintf(fd, " %lu %s:\n",
656
(long) td->td_nstrips,
657
isTiled(tif) ? "Tiles" : "Strips");
658
for (s = 0; s < td->td_nstrips; s++)
659
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
660
fprintf(fd, " %3lu: [%8I64u, %8I64u]\n",
662
(unsigned __int64) td->td_stripoffset[s],
663
(unsigned __int64) td->td_stripbytecount[s]);
665
fprintf(fd, " %3lu: [%8llu, %8llu]\n",
667
(unsigned long long) td->td_stripoffset[s],
668
(unsigned long long) td->td_stripbytecount[s]);
674
_TIFFprintAscii(FILE* fd, const char* cp)
676
_TIFFprintAsciiBounded( fd, cp, strlen(cp));
680
_TIFFprintAsciiBounded(FILE* fd, const char* cp, int max_chars)
682
for (; max_chars > 0 && *cp != '\0'; cp++, max_chars--) {
685
if (isprint((int)*cp)) {
689
for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
693
fprintf(fd, "\\%c", *tp);
695
fprintf(fd, "\\%03o", *cp & 0xff);
700
_TIFFprintAsciiTag(FILE* fd, const char* name, const char* value)
702
fprintf(fd, " %s: \"", name);
703
_TIFFprintAscii(fd, value);
707
/* vim: set ts=8 sts=8 sw=8 noet: */