tifftor4
Overview
tifftor4 inspects a TIFF image (libtiff)βextracting its width, height, bits per sample, samples per pixel, compression, and X/Y resolution tagsβand initializes a 32-bit floating-point OMG .r4 header (JHC_header) with matching dimensions (dx, dy, and -xystep).
Syntax & CLI Options
tifftor4 [-dB] [-min <DN>] [-max <DN>] [-low <val>] [-high <val>] [-ignore <val>] [-short] [-odd] [-xystep <step>] <tifffile> <r4file>
| Flag | Description |
|---|---|
-xystep <step> | Pixel grid spacing assigned to JHChead.xstep and JHChead.ystep. |
-dB | Enable decibel conversion flag. |
-min <DN> | Minimum digital number (default: 0, or -32768 with -short). |
-max <DN> | Maximum digital number (default: 255, or 32767 with -short). |
-low <val> | Output value corresponding to -min. |
-high <val> | Output value corresponding to -max. |
-ignore <val> | Input digital number to ignore / map to 0.0 (default: 256). |
-short | Treat input samples as 16-bit signed integers. |
-odd | When used with -short, ignore even sample values. |
<tifffile> | Input TIFF filename. |
<r4file> | Output .r4 filename. |
How It Works
- Opens
<tifffile>viaTIFFOpen(bytename, "r")fromlibtiff. - Queries and prints standard TIFF tags:
TIFFTAG_IMAGEWIDTH(dx) andTIFFTAG_IMAGELENGTH(dy)TIFFTAG_SAMPLESPERPIXEL,TIFFTAG_BITSPERSAMPLE,TIFFTAG_IMAGEDEPTH, andTIFFTAG_COMPRESSIONTIFFTAG_XPOSITION,TIFFTAG_XRESOLUTION,TIFFTAG_YPOSITION, andTIFFTAG_YRESOLUTION
- Initializes an
OMG1JHC_headerwithdx,dy,xstep = ystep = step, anddata_type = 3, and writes the header to<r4file>.
Examples
Inspect a TIFF file and write an .r4 header with 5 m grid spacing
tifftor4 -xystep 5.0 survey_bathy.tif survey_bathy.r4