54 "palette color (RGB from colormap)",
69#define NPHOTONAMES (sizeof(photoNames) / sizeof(photoNames[0]))
80 "row 0 top, col 0 lhs",
81 "row 0 top, col 0 rhs",
82 "row 0 bottom, col 0 rhs",
83 "row 0 bottom, col 0 lhs",
84 "row 0 lhs, col 0 top",
85 "row 0 rhs, col 0 top",
86 "row 0 rhs, col 0 bottom",
87 "row 0 lhs, col 0 bottom",
95#define NORIENTNAMES (sizeof(orientNames) / sizeof(orientNames[0]))
131#define NTAGS (sizeof(tagnames) / sizeof(tagnames[0]))
161 uint32_t value_count,
void *raw_data)
170 for (
size_t i = 0; i <
NTAGS; ++i)
179 fprintf(fd,
" %s: ", field_name);
181 for (j = 0; j < value_count; j++)
184 fprintf(fd,
"%" PRIu8, ((uint8_t *)raw_data)[j]);
186 fprintf(fd,
"0x%" PRIx8, ((uint8_t *)raw_data)[j]);
188 fprintf(fd,
"%" PRId8, ((int8_t *)raw_data)[j]);
190 fprintf(fd,
"%" PRIu16, ((uint16_t *)raw_data)[j]);
192 fprintf(fd,
"%" PRId16, ((int16_t *)raw_data)[j]);
194 fprintf(fd,
"%" PRIu32, ((uint32_t *)raw_data)[j]);
196 fprintf(fd,
"%" PRId32, ((int32_t *)raw_data)[j]);
198 fprintf(fd,
"0x%" PRIx32, ((uint32_t *)raw_data)[j]);
204 fprintf(fd,
"%lf", ((
double *)raw_data)[j]);
206 fprintf(fd,
"%f", (
double)((
float *)raw_data)[j]);
209 fprintf(fd,
"%f", (
double)((
float *)raw_data)[j]);
211 fprintf(fd,
"%" PRIu64, ((uint64_t *)raw_data)[j]);
213 fprintf(fd,
"%" PRId64, ((int64_t *)raw_data)[j]);
215 fprintf(fd,
"0x%" PRIx64, ((uint64_t *)raw_data)[j]);
217 fprintf(fd,
"%lf", ((
double *)raw_data)[j]);
220 fprintf(fd,
"%s", (
char *)raw_data);
225 fprintf(fd,
"<unsupported data type in TIFFPrint>");
229 if (j < value_count - 1)
269 uint32_t
tag, uint32_t value_count,
285 fprintf(fd,
" Ink Set: ");
286 switch (*((uint16_t *)raw_data))
289 fprintf(fd,
"CMYK\n");
292 fprintf(fd,
"%" PRIu16
" (0x%" PRIx16
")\n",
293 *((uint16_t *)raw_data),
294 *((uint16_t *)raw_data));
304 fprintf(fd,
" Dot Range: %" PRIu16
"-%" PRIu16
"\n",
305 ((uint16_t *)raw_data)[0], ((uint16_t *)raw_data)[1]);
313 fprintf(fd,
" White Point: %g-%g\n",
314 (
double)((
float *)raw_data)[0],
315 (
double)((
float *)raw_data)[1]);
324 fprintf(fd,
" XMLPacket (XMP Metadata):\n");
325 for (i = 0; i < value_count; i++)
326 fputc(((
char *)raw_data)[i], fd);
331 fprintf(fd,
" RichTIFFIPTC Data: <present>, %" PRIu32
" bytes\n",
336 fprintf(fd,
" Photoshop Data: <present>, %" PRIu32
" bytes\n",
341 fprintf(fd,
" ICC Profile: <present>, %" PRIu32
" bytes\n",
348 fprintf(fd,
" Sample to Nits conversion factor: %.4e\n",
349 *((
double *)raw_data));
370 fprintf(fd,
"TIFF Directory at offset 0x%" PRIx64
" (%" PRIu64
")\n",
374 fprintf(fd,
" Subfile Type:");
378 fprintf(fd,
"%sreduced-resolution image", sep);
383 fprintf(fd,
"%smulti-page document", sep);
387 fprintf(fd,
"%stransparency mask", sep);
388 fprintf(fd,
" (%" PRIu32
" = 0x%" PRIx32
")\n", td->
td_subfiletype,
393 fprintf(fd,
" Image Width: %" PRIu32
" Image Length: %" PRIu32,
401 fprintf(fd,
" Tile Width: %" PRIu32
" Tile Length: %" PRIu32,
416 fprintf(fd,
" (unitless)");
419 fprintf(fd,
" pixels/inch");
422 fprintf(fd,
" pixels/cm");
425 fprintf(fd,
" (unit %" PRIu16
" = 0x%" PRIx16
")",
433 fprintf(fd,
" Position: %g, %g\n", (
double)td->
td_xposition,
439 fprintf(fd,
" Sample Format: ");
443 fprintf(fd,
"void\n");
446 fprintf(fd,
"signed integer\n");
449 fprintf(fd,
"unsigned integer\n");
452 fprintf(fd,
"IEEE floating point\n");
455 fprintf(fd,
"complex signed integer\n");
458 fprintf(fd,
"complex IEEE floating point\n");
461 fprintf(fd,
"%" PRIu16
" (0x%" PRIx16
")\n",
469 fprintf(fd,
" Compression Scheme: ");
471 fprintf(fd,
"%s\n", c->
name);
478 fprintf(fd,
" Photometric Interpretation: ");
486 fprintf(fd,
"CIE Log2(L)\n");
489 fprintf(fd,
"CIE Log2(L) (u',v')\n");
492 fprintf(fd,
"%" PRIu16
" (0x%" PRIx16
")\n",
509 fprintf(fd,
"%sunspecified", sep);
512 fprintf(fd,
"%sassoc-alpha", sep);
515 fprintf(fd,
"%sunassoc-alpha", sep);
518 fprintf(fd,
"%s%" PRIu16
" (0x%" PRIx16
")", sep,
530 fprintf(fd,
" Ink Names: ");
535 cp = strchr(cp,
'\0') + 1, i--)
551 fprintf(fd,
" Thresholding: ");
555 fprintf(fd,
"bilevel art scan\n");
558 fprintf(fd,
"halftone or dithered scan\n");
561 fprintf(fd,
"error diffused\n");
564 fprintf(fd,
"%" PRIu16
" (0x%" PRIx16
")\n",
571 fprintf(fd,
" FillOrder: ");
575 fprintf(fd,
"msb-to-lsb\n");
578 fprintf(fd,
"lsb-to-msb\n");
581 fprintf(fd,
"%" PRIu16
" (0x%" PRIx16
")\n", td->
td_fillorder,
588 fprintf(fd,
" YCbCr Subsampling: %" PRIu16
", %" PRIu16
"\n",
593 fprintf(fd,
" YCbCr Positioning: ");
597 fprintf(fd,
"centered\n");
600 fprintf(fd,
"cosited\n");
603 fprintf(fd,
"%" PRIu16
" (0x%" PRIx16
")\n",
609 fprintf(fd,
" Halftone Hints: light %" PRIu16
" dark %" PRIu16
"\n",
613 fprintf(fd,
" Orientation: ");
624 fprintf(fd,
" Rows/Strip: ");
626 fprintf(fd,
"(infinite)\n");
639 fprintf(fd,
" SMin Sample Value:");
640 for (i = 0; i < count; ++i)
649 fprintf(fd,
" SMax Sample Value:");
650 for (i = 0; i < count; ++i)
656 fprintf(fd,
" Planar Configuration: ");
660 fprintf(fd,
"single image plane\n");
663 fprintf(fd,
"separate image planes\n");
666 fprintf(fd,
"%" PRIu16
" (0x%" PRIx16
")\n",
672 fprintf(fd,
" Page Number: %" PRIu16
"-%" PRIu16
"\n",
677 fprintf(fd,
" Color Map: ");
683 " %5" PRIu32
": %5" PRIu16
" %5" PRIu16
" %5" PRIu16
689 fprintf(fd,
"(present)\n");
694 fprintf(fd,
" Reference Black/White:\n");
695 for (i = 0; i < 3; i++)
696 fprintf(fd,
" %2d: %5g %5g\n", i,
706 fprintf(fd,
" Transfer Function: ");
713 fprintf(fd,
" %2" PRIu32
": %5" PRIu16, l,
723 fprintf(fd,
"(present)\n");
728 fprintf(fd,
" SubIFD Offsets:");
730 fprintf(fd,
" %5" PRIu64, td->
td_subifd[i]);
742 for (i = 0; i < count; i++)
746 uint32_t value_count;
748 void *raw_data = NULL;
749 uint16_t dotrange[2];
765 uint16_t small_value_count;
769 value_count = small_value_count;
813 if (raw_data == NULL)
830 if (raw_data != NULL &&
847 fprintf(fd,
" %" PRIu32
" %s:\n", td->
td_nstrips,
848 isTiled(tif) ?
"Tiles" :
"Strips");
850 fprintf(fd,
" %3" PRIu32
": [%8" PRIu64
", %8" PRIu64
"]\n", s,
887 for (; max_chars > 0 && *cp !=
'\0'; cp++, max_chars--)
891 if (isprint((
int)*cp))
896 for (tp =
"\tt\bb\rr\nn\vv"; *tp; tp++)
900 fprintf(fd,
"\\%c", *tp);
902 fprintf(fd,
"\\%03o", (
unsigned int)(*cp & 0xff));
908 fprintf(fd,
" %s: \"",
name);
static int _TIFFPrettyPrintField(TIFF *tif, const TIFFField *fip, FILE *fd, uint32_t tag, uint32_t value_count, void *raw_data)
Try specialised formatting for selected named custom tags.
#define NORIENTNAMES
Count orientation display entries, including the zero placeholder.
#define NPHOTONAMES
Count the entries in photoNames, including the reserved placeholder.
#define NTAGS
Count the anonymous-tag friendly-name overrides.
static void _TIFFPrintField(FILE *fd, const TIFFField *fip, uint32_t value_count, void *raw_data)
Print a custom field using its generic numeric or string representation.
void _TIFFprintAsciiTag(FILE *fd, const char *name, const char *value)
Print a labelled quoted value using the private ASCII formatter.
static const struct tagname tagnames[]
Supply display labels for anonymous GDAL metadata and nodata tags.
static void _TIFFprintAsciiBounded(FILE *fd, const char *cp, size_t max_chars)
Print at most a byte bound using the private ASCII escape convention.
static const char *const photoNames[]
Map common photometric identifiers to display names.
void _TIFFprintAscii(FILE *fd, const char *cp)
Print a terminated string using the private ASCII escape convention.
static const char *const orientNames[]
Map orientation identifiers to display descriptions.
#define FIELD_RESOLUTION
Index the resolution presence bit; not an on-disk tag number.
#define FIELD_SUBFILETYPE
Index the subfile type presence bit; not an on-disk tag number.
#define FIELD_STRIPOFFSETS
Index the strile offsets presence bit; not an on-disk tag number.
#define FIELD_TRANSFERFUNCTION
Index the transfer function presence bit; not an on-disk tag number.
#define FIELD_HALFTONEHINTS
Index the halftone hints presence bit; not an on-disk tag number.
#define FIELD_ORIENTATION
Index the orientation presence bit; not an on-disk tag number.
#define FIELD_MINSAMPLEVALUE
Index the minimum sample value presence bit; not an on-disk tag number.
#define FIELD_FILLORDER
Index the fill order presence bit; not an on-disk tag number.
#define FIELD_SMAXSAMPLEVALUE
Index the per-sample maximum presence bit; not an on-disk tag number.
#define FIELD_IMAGEDIMENSIONS
Index the image dimensions presence bit; not an on-disk tag number.
#define FIELD_YCBCRSUBSAMPLING
Index the YCbCr subsampling presence bit; not an on-disk tag number.
#define FIELD_COLORMAP
Index the colormap presence bit; not an on-disk tag number.
#define FIELD_SUBIFD
Index the child IFD presence bit; not an on-disk tag number.
#define FIELD_EXTRASAMPLES
Index the extra samples presence bit; not an on-disk tag number.
#define FIELD_IMAGEDEPTH
Index the image depth presence bit; not an on-disk tag number.
#define FIELD_SMINSAMPLEVALUE
Index the per-sample minimum presence bit; not an on-disk tag number.
#define TIFFFieldSet(tif, field)
Test a directory presence bit.
#define FIELD_MAXSAMPLEVALUE
Index the maximum sample value presence bit; not an on-disk tag number.
#define FIELD_NUMBEROFINKS
Index the number of inks presence bit; not an on-disk tag number.
#define FIELD_TILEDEPTH
Index the tile depth presence bit; not an on-disk tag number.
#define FIELD_TILEDIMENSIONS
Index the tile dimensions presence bit; not an on-disk tag number.
#define FIELD_POSITION
Index the position presence bit; not an on-disk tag number.
#define FIELD_ROWSPERSTRIP
Index the rows per strip presence bit; not an on-disk tag number.
#define FIELD_COMPRESSION
Index the compression presence bit; not an on-disk tag number.
#define FIELD_YCBCRPOSITIONING
Index the YCbCr positioning presence bit; not an on-disk tag number.
#define FIELD_REFBLACKWHITE
Index the reference black/white presence bit; not an on-disk tag number.
#define FIELD_SAMPLEFORMAT
Index the sample format presence bit; not an on-disk tag number.
#define FIELD_PAGENUMBER
Index the page number presence bit; not an on-disk tag number.
#define FIELD_BITSPERSAMPLE
Index the bits per sample presence bit; not an on-disk tag number.
#define FIELD_INKNAMES
Index the ink names presence bit; not an on-disk tag number.
#define FIELD_RESOLUTIONUNIT
Index the resolution unit presence bit; not an on-disk tag number.
#define FIELD_PLANARCONFIG
Index the planar configuration presence bit; not an on-disk tag number.
#define FIELD_SAMPLESPERPIXEL
Index the samples per pixel presence bit; not an on-disk tag number.
#define FIELD_PHOTOMETRIC
Index the photometric presence bit; not an on-disk tag number.
#define FIELD_THRESHHOLDING
Index the thresholding presence bit; not an on-disk tag number.
void _TIFFfreeExt(TIFF *tif, void *p)
Release a handle-aware allocation and its payload charge.
void * _TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Allocate a checked array with an allocation-failure diagnostic.
#define isTiled(tif)
Test whether a handle uses tiled storage.
#define TIFF_PERSAMPLE
Select per-sample arrays for supported sample-valued fields.
const TIFFCodec * TIFFFindCODEC(uint16_t scheme)
Find the highest-priority descriptor for a compression scheme.
#define TIFFPRINT_STRIPS
Include strip/tile offsets and byte counts in directory printing.
#define TIFFPRINT_COLORMAP
Include palette entries in directory printing.
#define TIFF_SPP
Mark a field whose count follows SamplesPerPixel.
#define TIFF_VARIABLE
Mark a variable-length field with a 16-bit count convention.
#define TIFFPRINT_CURVES
Include transfer-function curves in directory printing.
#define TIFF_VARIABLE2
Mark a variable-length field with a 32-bit count convention.
void TIFFPrintDirectory(TIFF *tif, FILE *fd, long flags)
Print a human-readable description of the current directory.
uint32_t TIFFGetTagListEntry(TIFF *tif, int tag_index)
Look up a tag number by its custom-value list index.
int TIFFFieldIsAnonymous(const TIFFField *fip)
Test whether a field was registered as an unknown tag.
const TIFFField * TIFFFieldWithTag(TIFF *tif, uint32_t tag)
Find a registered field by tag number.
int TIFFGetTagListCount(TIFF *tif)
Count values stored in the current custom-tag list.
int TIFFFieldSetGetSize(const TIFFField *fip)
Report the internal element storage width of a field.
int TIFFGetField(TIFF *tif, uint32_t tag,...)
Query a present tag in the current directory.
@ TIFF_SSHORT
Signed 16-bit integer.
@ TIFF_SLONG
Signed 32-bit integer.
@ TIFF_BYTE
Unsigned 8-bit integer.
@ TIFF_SBYTE
Signed 8-bit integer.
@ TIFF_IFD
Unsigned 32-bit IFD byte offset.
@ TIFF_SHORT
Unsigned 16-bit integer.
@ TIFF_UNDEFINED
Untyped 8-bit data.
@ TIFF_LONG
Unsigned 32-bit integer.
@ TIFF_SLONG8
BigTIFF signed 64-bit integer.
@ TIFF_LONG8
BigTIFF unsigned 64-bit integer.
@ TIFF_ASCII
Sequence of 8-bit bytes ending in a null byte.
@ TIFF_FLOAT
32-bit IEEE floating-point value.
@ TIFF_DOUBLE
64-bit IEEE floating-point value.
@ TIFF_IFD8
BigTIFF unsigned 64-bit IFD byte offset.
@ TIFF_SRATIONAL
Signed 32-bit numerator and denominator.
@ TIFF_RATIONAL
Unsigned 32-bit numerator and denominator.
Describe a named compression scheme and its initialiser.
const char * name
Codec name; storage lifetime follows the API supplying this descriptor.
Store the current directory values and image traversal state.
uint16_t td_pagenumber[2]
Page index and total-page count as two uint16_t values.
float td_xposition
Horizontal image position in resolution units.
uint32_t td_tiledepth
Tile depth in slices.
uint16_t td_fillorder
FILLORDER_* bit order within file bytes.
float td_xresolution
Horizontal pixels per resolution unit.
int td_inknameslen
Byte length of the concatenated ink-name strings, including terminators.
uint16_t * td_sampleinfo
Owned ExtraSamples interpretation array of td_extrasamples entries, or NULL.
float * td_refblackwhite
Owned six-float reference black/white array, or NULL.
uint32_t td_rowsperstrip
Rows per strip; UINT32_MAX represents one whole-image strip.
uint32_t td_imagewidth
Image width in pixels.
uint16_t td_compression
COMPRESSION_* codec identifier.
uint16_t td_photometric
PHOTOMETRIC_* interpretation.
uint32_t td_tilewidth
Tile width in pixels.
float td_yresolution
Vertical pixels per resolution unit.
uint16_t td_extrasamples
Number of extra samples described by td_sampleinfo.
uint16_t td_threshholding
THRESHHOLD_* bilevel rendering convention.
uint16_t td_minsamplevalue
Legacy unsigned minimum sample value.
double * td_sminsamplevalue
Owned SamplesPerPixel-length array of minimum values, or NULL.
uint16_t td_bitspersample
Bits in each sample.
char * td_inknames
Owned concatenated null-terminated ink names, or NULL.
uint16_t * td_transferfunction[3]
Up to three owned gamma curves of td_transferfunction_count entries each.
uint16_t td_maxsamplevalue
Legacy unsigned maximum sample value.
uint32_t td_imagedepth
Image depth in slices.
uint16_t td_orientation
ORIENTATION_* storage orientation.
uint16_t td_resolutionunit
RESUNIT_* unit for resolution and position values.
uint32_t td_colormap_count
Number of entries in each ColorMap plane that the directory uses, zero when none is installed.
uint16_t td_planarconfig
PLANARCONFIG_* sample-plane arrangement.
double * td_smaxsamplevalue
Owned SamplesPerPixel-length array of maximum values, or NULL.
uint16_t * td_colormap[3]
Three owned palette planes of td_colormap_alloc entries each, or NULL slots; presence is FIELD_COLORM...
uint16_t td_sampleformat
SAMPLEFORMAT_* interpretation of samples.
uint16_t td_ycbcrsubsampling[2]
Horizontal and vertical YCbCr subsampling factors.
uint16_t td_samplesperpixel
Samples per pixel, including extra samples.
uint32_t td_subfiletype
NewSubfileType flag mask.
uint32_t td_nstrips
Total strile count across all planes; logical array length.
uint16_t td_numberofinks
Number of inks, kept consistent with accepted InkNames where possible.
uint32_t td_imagelength
Image length in rows.
uint32_t td_tilelength
Tile length in rows.
uint16_t td_nsubifd
Number of child-directory offsets in td_subifd.
uint64_t * td_subifd
Owned array of td_nsubifd child-directory offsets, or NULL.
float td_yposition
Vertical image position in resolution units.
uint32_t td_transferfunction_count
Number of entries in each installed TransferFunction curve, zero when none is installed; the only rec...
uint16_t td_ycbcrpositioning
YCBCRPOSITION_* placement convention.
uint16_t td_halftonehints[2]
Highlight and shadow grayscale breakpoints.
TIFFPrintMethod printdir
Optional codec/extension directory-print callback.
Describe a field's file type and internal argument contract.
TIFFDataType field_type
On-disk TIFFDataType, distinct from the argument representation.
unsigned char field_passcount
Nonzero for an explicit count argument; tag-specific exceptions still apply.
const char * field_name
Borrowed or anonymous-owned null-terminated name; must remain live while used.
uint32_t field_tag
Tag identifier in this schema namespace.
short field_readcount
Fixed getter count or TIFF_VARIABLE/TIFF_VARIABLE2/TIFF_SPP rule.
Associate an anonymous on-disk tag with a friendly print label.
const char * name
Borrowed static null-terminated display name.
uint16_t tag
On-disk tag identifier to relabel.
Hold private state for one open TIFF library instance.
TIFFTagMethods tif_tagmethods
Inline table of directory field and print callbacks.
uint64_t tif_diroff
Current directory byte offset, or zero for an unlinked in-memory IFD.
TIFFDirectory tif_dir
Inline representation of the current image directory.
uint32_t tif_flags
Bitmask combining the TIFF_* handle-state flags declared below.
Declare private library state, callbacks, and implementation helpers.