Linux Commands Examples

A great documentation place for Linux commands


create a TIFF file from a raw data

see also : pal2rgb - tiffinfo - tiffcp - tiffmedian


raw2tiff [ options ] input.raw output.tif

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


no example yet ...

... Feel free to add your own example above to help other Linux-lovers !


raw2tiff converts a raw byte sequence into TIFF. By default, the TIFF image is created with data samples packed (PlanarConfiguration=1), compressed with the PackBits algorithm (Compression=32773), and with each strip no more than 8 kilobytes. These characteristics can overridden, or explicitly specified with the options described below.


-H number

size of input image file header in bytes (0 by default). This amount of data just will be skipped from the start of file while reading.

-w number

width of input image in pixels (can be guessed, see GUESSING THE IMAGE GEOMETRY below).

-l number

length of input image in lines (can be guessed, see GUESSING THE IMAGE GEOMETRY below).

-b number

number of bands in input image (1 by default).

-d data_type

type of samples in input image, where data_type may be:


8-bit unsigned integer (default),


16-bit unsigned integer,


32-bit unsigned integer,


8-bit signed integer,


16-bit signed integer,


32-bit signed integer,


32-bit IEEE floating point,


64-bit IEEE floating point.

-i config

type of samples interleaving in input image, where config may be:


pixel interleaved data (default),


band interleaved data.

-p photo

photometric interpretation (color space) of the input image, where photo may be:


white color represented with 0 value,


black color represented with 0 value (default),


image has RGB color model,


image has CMYK (separated) color model,


image has YCbCr color model,


image has CIE L*a*b color model,


image has ICC L*a*b color model,


image has ITU L*a*b color model.


swap bytes fetched from the input file.


input data has LSB2MSB bit order (default).


input data has MSB2LSB bit order.


Specify a compression scheme to use when writing image data: -c none for no compression, -c packbits for the PackBits compression algorithm (the default), -c jpeg for the baseline JPEG compression algorithm, -c zip for the Deflate compression algorithm, and -c lzw for Lempel-Ziv & Welch.

-r number

Write data with a specified number of rows per strip; by default the number of rows/strip is selected so that each strip is approximately 8 kilobytes.

guessing the image geometry

raw2tiff can guess image width and height in case one or both of these parameters are not specified. If you omit one of those parameters, the complementary one will be calculated based on the file size (taking into account header size, number of bands and data type). If you omit both parameters, the statistical approach will be used. Utility will compute correlation coefficient between two lines at the image center using several appropriate line sizes and the highest absolute value of the coefficient will indicate the right line size. That is why you should be cautious with the very large images, because guessing process may take a while (depending on your system performance). Of course, the utility can’t guess the header size, number of bands and data type, so it should be specified manually. If you don’t know anything about your image, just try with the several combinations of those options.

There is no magic, it is just a mathematical statistics, so it can be wrong in some cases. But for most ordinary images guessing method will work fine.

see also

pal2rgb , tiffinfo , tiffcp , tiffmedian , libtiff

Libtiff library home page:

How can this site be more helpful to YOU ?

give  feedback