{
    "mode": "info",
    "parameter": "pnmtotiff",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/pnmtotiff/json",
    "generated": "2026-07-04T23:10:44Z",
    "synopsis": "pnmtotiff  [-none|-packbits|-lzw|-g3|-g4]  [-2d] [-fill] [-predictor n]\n[-msb2lsb|-lsb2msb] [-rowsperstrip n] [-minisblack|-miniswhite] [-true-\ncolor] [-color] [-indexbits 1|2|4|8] [pnmfile]\nMinimum unambiguous abbreviations of options are acceptable.",
    "sections": {
        "NAME": {
            "content": "pnmtotiff - convert a portable anymap into a TIFF file\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "pnmtotiff  [-none|-packbits|-lzw|-g3|-g4]  [-2d] [-fill] [-predictor n]\n[-msb2lsb|-lsb2msb] [-rowsperstrip n] [-minisblack|-miniswhite] [-true-\ncolor] [-color] [-indexbits 1|2|4|8] [pnmfile]\n\nMinimum unambiguous abbreviations of options are acceptable.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Reads a PNM image as input.  Produces a TIFF file as output.\n\nThe  output  goes  to  Standard  Output, which must be a seekable file.\nThat means no pipes, but any regular file should work.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "By default, pnmtotiff creates a TIFF file with no compression.  This is\nyour best bet most of the time.  If you want to try another compression\nscheme or tweak some of the other even  more  obscure  output  options,\nthere are a number of flags to play with.\n\nActually,  the  best  default would be to use LZW compression, which is\nwhat pnmtotiff used to do by default.  However,  the  Tiff  library  no\nlonger  does  LZW  compression  due to concerns with violating Unisys's\npatent on LZW compression.\n\nThe -none, -packbits, -lzw, -g3, -g4, -flate,  and  -adobeflat  options\nare used to override the default and set the compression scheme used in\ncreating the output file.  The CCITT Group 3 and  Group  4  compression\nalgorithms  can  only  be  used with bilevel data.  -lzw doesn't really\nwork because the Tiff library doesn't do LZW compression.  It used  to,\nbut  its developers removed the function out of concern about violating\nUnisys's patent.  This option remains in case you use  a  Tiff  library\nthat  cooperates,  now or in the future.  The -2d and -fill options are\nmeaningful only with Group 3 compression:  -2d  requests  2-dimensional\nencoding,  while  -fill  requests  that  each encoded scanline be zero-\nfilled to a byte boundry.  The -predictor  option  is  only  meaningful\nwith  LZW  compression:  a predictor value of 2 causes each scanline of\nthe output image to undergo horizontal differencing before  it  is  en-\ncoded;  a value of 1 forces each scanline to be encoded without differ-\nencing.\n\nBy default, pnmtotiff creates a TIFF file with msb-to-lsb  fill  order.\nThe  -msb2lsb and -lsb2msb options are used to override the default and\nset the fill order used in creating the file.\n\nThe fill order is the order in which pixels are packed into a  byte  in\nthe  Tiff  raster, in the case that there are multiple pixels per byte.\nmsb-to-lsb means that the leftmost columns go into the most significant\nbits  of  the  byte  in the Tiff image.  However, there is considerable\nconfusion about the meaning of  fill  order.   Some  believe  it  means\nwhether  16  bit  sample  values in the Tiff image are little-endian or\nbig-endian.  This is totally erroneous (The endianness of integers in a\nTiff image is designated by the image's magic number).  However, Image-\nMagick and older Netpbm both have been known to implement  that  inter-\npretation.  2001.09.06.\n\nIf  the  image does not have sub-byte pixels, these options have no ef-\nfect other than to set the value of the FILLORDER tag in the Tiff image\n(which  may be useful for those programs that misinterpret the tag with\nreference to 16 bit samples).\n\nThe -rowsperstrip option can be used to set the number of  rows  (scan-\nlines)  in each strip of data in the output file.  By default, the out-\nput file has the number of rows per strip set to a value that will  en-\nsure each strip is no more than 8 kilobytes long.\n\nThe -minisblack and -miniswhite option force the output image to have a\n\"minimum is black\" or \"minimum is white\" photometric, respectively.  If\nyou  don't  specify either, pnmtotiff uses minimum is black except when\nusing Group 3 or Group 4 compression, in which case  pnmtotiff  follows\nCCITT  fax standards and uses \"minimum is white.\"  This usually results\nin better compression and is generally preferred for bilevel coding.\n\nBefore February 2001, pnmtotiff always produced \"minimum is black,\" due\nto  a  bug.  In either case, pnmtotiff sets the photometric interpreta-\ntion tag in the TIFF output according to which photometric is  actually\nused.\n\n-truecolor  tells pnmtotiff to produce the 24-bit RGB form of TIFF out-\nput if it is producing a color TIFF image.  Without this option, pnmto-\ntiff  produces  a  colormapped (paletted) 8-bit TIFF image unless there\nare more than 256 colors (and in the latter case, issues a warning).\n\nThe -truecolor option can prevent  pnmtotiff  from  making  two  passes\nthrough the input file, thus improving speed and memory usage.  See the\nsection MULTIPLE PASSES.\n\nIf pnmtotiff produces a grayscale TIFF image, this option  has  no  ef-\nfect.\n\n-color  tells  pnmtotiff  to  produce a color, as opposed to grayscale,\nTIFF image if the input is PPM, even if  it  contains  only  shades  of\ngray.   Without  this option, pnmtotiff produces a grayscale TIFF image\nif the input is PPM and contains only shades of gray, and at  most  256\nshades.   Otherwise,  it produces a color TIFF output.  For PBM and PGM\ninput, pnmtotiff always produces grayscale TIFF output and this  option\nhas no effect.\n\nThe  -color option can prevent pnmtotiff from making two passes through\nthe input file, thus improving speed and memory usage.  See the section\nMULTIPLE PASSES.\n\nThe  -indexbits  option is meaningful only for a colormapped (paletted)\nimage. In this kind of image, the raster contains values which are  in-\ndexes  into  a  table  of colors, with the indexes normally taking less\nspace that the color description in the table. pnmtotiff  can  generate\nindexes  of 1, 2, 4, or 8 bits. By default, it will use 8, because many\nprograms that interpret TIFF images can't handle any other width.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "There are myriad variations of the TIFF format, and this program gener-\nates  only  a  few of them.  pnmtotiff creates a grayscale TIFF file if\nits input is a PBM (monochrome) or  PGM  (grayscale)  file.   pnmtotiff\nalso  creates a grayscale file if it input is PPM (color), but there is\nonly one color in the image.  If the input is a PPM  (color)  file  and\nthere  are  256 colors or fewer, but more than 1, pnmtotiff generates a\ncolor palette TIFF file.  If there are more colors than that, pnmtotiff\ngenerates  an RGB (not RGBA) single plane TIFF file.  Use pnmtotiffcmyk\nto generate the cyan-magenta-yellow-black  ink  color  separation  TIFF\nformat.\n\nThe  number  of bits per sample in the TIFF output is determined by the\nmaxval of the PNM input.  If the maxval is less than 256, the bits  per\nsample in the output is the smallest number that can encode the maxval.\nIf the maxval is greater than or equal to 256, there are  16  bits  per\nsample in the output.\n\nMultiple Passes\npnmtotiff  reads  the  input image once if it can, and otherwise twice.\nIt needs that second pass to analyze the colors in the image and gener-\nate a color map (pallette) and determine if the image is grayscale.  So\nthe second pass only happens when the input is PPM.  And you can  avoid\nit then by specifying both the -truecolor and -color options.\n\nIf  the input image is small enough to fit in your system's file cache,\nthe second pass is very fast.  If not, it requires  reading  from  disk\ntwice, which can be slow.\n\nWhen the input is from a file that cannot be rewound and reread, pnmto-\ntiff reads the entire input image into a temporary file which can,  and\nworks from that.  Even if it only needs one pass.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "tifftopnm(1), pnmtotiffcmyk(1), pnmdepth(1), pnm(5)\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Derived  by  Jef Poskanzer from ras2tiff.c, which is Copyright (c) 1990\nby   Sun   Microsystems,   Inc.    Author:    Patrick    J.    Naughton\n(naughton@wind.sun.com).\n\n24 January 2001                   pnmtotiff(1)",
            "subsections": []
        }
    },
    "summary": "pnmtotiff - convert a portable anymap into a TIFF file",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "tifftopnm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/tifftopnm/1/json"
        },
        {
            "name": "pnmtotiffcmyk",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmtotiffcmyk/1/json"
        },
        {
            "name": "pnmdepth",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmdepth/1/json"
        },
        {
            "name": "pnm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pnm/5/json"
        }
    ]
}