Linux Commands Examples

A great documentation place for Linux commands


convert a portable anymap into a CMYK encoded TIFF file

see also : pnmtotiff - tifftopnm


pnmtotiffcmyk [Compargs][Tiffargs][Convargs][ pnmfile ]

[-none|-packbits|-lzw [-predictor n]]


[-msb2lsb|-lsb2msb] [-rowsperstrip n]
[-lowdotrange n] [-highdotrange n]




[-theta deg] [-gamma n] [-gammap -1|-gammap n]

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!


pnminterp pnmnoraw pnmscale pnmsplit pnmtofits pnmtojpeg pnmtopnm pnmtops \\\
pnmtotiff pnmtotiffcmyk ppmnorm ppmsvgalib ppmtojpeg ppmtotga ppmtouil \\\
pnminterp pnmnoraw pnmscale pnmsplit pnmtofits pnmtojpeg pnmtopnm pnmtops \\\
pnmtotiff pnmtotiffcmyk ppmnorm ppmsvgalib ppmtojpeg ppmtotga ppmtouil \\\
tifftopnm vidtoppm \
pnminterp pnmnoraw pnmscale pnmsplit pnmtofits pnmtojpeg pnmtopnm pnmtops \\\
pnmtotiff pnmtotiffcmyk ppmnorm ppmsvgalib ppmtojpeg ppmtotga ppmtouil \\\


Reads a portable anymap as input. Produces a CMYK encoded TIFF file as output. Optionally modifies the colour balance and black level, and removes CMY from under K.


The order of most options is not important, but options for particular conversion algorithms must appear after the algorithm is selected (-default,-negative). If no algorithm is selected then -default is assumed and the appropriate options (-theta,-gamma,-gammap) can appear anywhere.

Tiff files can be compressed. By default LZW decompression is used, but (apparently) some readers cannot read this, so you may want to select a different algorithm (-none,-packbits). For LZW compression, a -predictor value of 2 forces horizontal differencing of scanlines before encoding; a value of 1 forces no differencing.


These flags control fill order (default is -msb2lsb).


This sets the number of rows in an image strip (data in the Tiff files generated by this program is stored in strips - each strip is compressed individually). The default gives a strip size of no more than 8 kb.


These options set tag values that may be useful for printers. They have not been tested.


These options modify the values written to the Tiff file after the conversion calculations (described below) are completed. They are useful only for testing and debugging the code.

-kremove sets the black (K) layer to zero while -konly sets all inks to the black value.


-negative selects a simple algorithm that generates a colour negative. None of the following options apply to this algorithm, which is included as an example in the source to help implementors of other conversions. -default is not needed, unless it is used to countermand a -negative on the same command line. The default conversion from RGB to CMYK can be modified by altering the options listed below.

The CMYKTiff web site includes tests on the conversion parameters. The test images illustrate the command line options in practice and may make the following explanation clearer.

-theta deg

The basic conversion from RGB to CMY uses C = 1-R, M = 1-G, Y = 1-B. -theta provides a simple correction for any colour bias that may occur in the printed image because, in practice, inks do not exactly complement the primary colours. It rotates the colours by the amount given (deg) in degrees. Unless you are trying to produce unusual effects you will need to use small values (try generating three images at -10, 0 (the default) and 10 degrees and seeing which has the best colour balance.

-gamma n

The black (K) component of the image is calculated as min(C,Y,M). -gamma applies a gamma correction to this level. In other words, the final black level is K (normalised to the range 0 to 1) raised to the nth power. In practice this means that a value greater than 1 makes the image lighter and a value less than 1 makes the image darker. The range of allowed values is 0.1 to 10.

-gammap n

This option controls the removal of CMY under K. If n is -1 then no removal occurs and C, M, Y and K are calculated as above. This means that, when printed, dark areas contain all four inks, which can make high contrast areas, like lettering, appear fuzzy.

By default, when -gammap is not given on the command line, the colours are reduced in dark areas by subtracting the black level. The value subtracted is calculated with the same gamma correction given by -gamma. Hopefully this will reduce fuzziness without changing the appearance of the image significantly.

If -gammap n is given, with n between 0.01 and 10, then black is still subtracted, but the subtracted value is calculated using n rather than any value supplied with -gamma. For example, it may be best to only subtract black from the coloured inks in the very darkest regions. In that case, n should be a large value, such as 5.


This program is not self-contained. It must be used with NetPbm and libtiff must be available (libtiff is included in the 1mar94 release of NetPbm).

see also

pnmtotiff , tifftopnm , pnm


Copyright (c) 1999 Andrew Cooke (Jara Software). Released under the GPL with no warranty. See source or COPYRIGHT and LICENCE files in distribution for full details.

Much of the code (and man page!) uses ideas from other pnm programs, written by Jef Poskanzer (thanks go to him and libtiff maintainer Sam Leffler). A small section of the code - some of the tiff tag settings - is derived directly from pnmtotiff, by Jef Poskanzer, which, in turn, acknowledges Patrick Naughton with the following text:

Derived by Jef Poskanzer from ras2tif.c, which is:

Copyright (c) 1990 by Sun Microsystems, Inc.

Author: Patrick J. Naughton naughton[:at:]wind.sun[:dot:]com

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

This file is provided AS IS with no warranties of any kind. The author shall have no liability with respect to the infringement of copyrights, trade secrets or any patents by this file or any part thereof. In no event will the author be liable for any lost revenue or profits or other special, indirect and consequential damages.

How can this site be more helpful to YOU ?

give  feedback