{
    "content": [
        {
            "type": "text",
            "text": "# pnmtotiff(1) (man)\n\n**Summary:** pnmtotiff - convert a portable anymap into a TIFF file\n\n**Synopsis:** pnmtotiff  [-none|-packbits|-lzw|-g3|-g4]  [-2d]  [-fill]  [-predictor n] [-msb2lsb|-lsb2msb]\n[-rowsperstrip n] [-minisblack|-miniswhite] [-truecolor] [-color] [-indexbits 1|2|4|8]  [pnm‐\nfile]\nMinimum unambiguous abbreviations of options are acceptable.\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| — | — | — | option is only meaningful with LZW compression: a predictor value of 2 causes each scanline of the output image to under |\n| — | — | — | file. The fill order is the order in which pixels are packed into a byte in the Tiff raster, in the case that there are  |\n| — | — | — | color TIFF image. Without this option, pnmtotiff produces a colormapped (paletted) 8-bit TIFF image unless there are mor |\n| — | — | — | is PPM, even if it contains only shades of gray. Without this option, pnmtotiff produces a grayscale TIFF image if the i |\n\n## See Also\n\n- tifftopnm(1)\n- pnmtotiffcmyk(1)\n- pnmdepth(1)\n- pnm(5)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (8 lines)\n- **DESCRIPTION** (7 lines)\n- **OPTIONS** (15 lines) — 4 subsections\n  - -fill -predictor (5 lines)\n  - -lsb2msb (30 lines)\n  - -truecolor (8 lines)\n  - -color (15 lines)\n- **NOTES** (14 lines) — 1 subsections\n  - Multiple Passes (13 lines)\n- **SEE ALSO** (3 lines)\n- **AUTHOR** (6 lines)\n\n## Full Content\n\n### NAME\n\npnmtotiff - convert a portable anymap into a TIFF file\n\n### SYNOPSIS\n\npnmtotiff  [-none|-packbits|-lzw|-g3|-g4]  [-2d]  [-fill]  [-predictor n] [-msb2lsb|-lsb2msb]\n[-rowsperstrip n] [-minisblack|-miniswhite] [-truecolor] [-color] [-indexbits 1|2|4|8]  [pnm‐\nfile]\n\n\nMinimum unambiguous abbreviations of options are acceptable.\n\n### DESCRIPTION\n\nReads a PNM image as input.  Produces a TIFF file as output.\n\nThe  output goes to Standard Output, which must be a seekable file.  That means no pipes, but\nany regular file should work.\n\n### OPTIONS\n\nBy default, pnmtotiff creates a TIFF file with no compression.  This is your best bet most of\nthe time.  If you want to try another compression scheme or tweak some of the other even more\nobscure output options, there are a number of flags to play with.\n\nActually, the best default would be to use LZW compression, which is what pnmtotiff  used  to\ndo by default.  However, the Tiff library no longer does LZW compression due to concerns with\nviolating Unisys's patent on LZW compression.\n\nThe -none, -packbits, -lzw, -g3, -g4, -flate, and -adobeflat options are used to override the\ndefault  and  set the compression scheme used in creating the output file.  The CCITT Group 3\nand Group 4 compression algorithms can only be used with bilevel data.  -lzw  doesn't  really\nwork because the Tiff library doesn't do LZW compression.  It used to, but its developers re‐\nmoved the function out of concern about violating Unisys's patent.  This  option  remains  in\ncase you use a Tiff library that cooperates, now or in the future.  The -2d and -fill options\nare meaningful only with Group 3 compression:  -2d  requests  2-dimensional  encoding,  while\n\n#### -fill -predictor\n\noption is only meaningful with LZW compression: a predictor value of 2 causes  each  scanline\nof  the  output  image  to undergo horizontal differencing before it is encoded; a value of 1\nforces each scanline to be encoded without differencing.\n\nBy default, pnmtotiff creates a TIFF file with  msb-to-lsb  fill  order.   The  -msb2lsb  and\n\n#### -lsb2msb\n\nfile.\n\nThe fill order is the order in which pixels are packed into a byte in the Tiff raster, in the\ncase  that there are multiple pixels per byte.  msb-to-lsb means that the leftmost columns go\ninto the most significant bits of the byte in the Tiff image.  However, there is considerable\nconfusion  about the meaning of fill order.  Some believe it means whether 16 bit sample val‐\nues in the Tiff image are little-endian or big-endian.  This is totally erroneous (The  endi‐\nanness  of  integers  in  a  Tiff image is designated by the image's magic number).  However,\nImageMagick and  older  Netpbm  both  have  been  known  to  implement  that  interpretation.\n2001.09.06.\n\nIf  the  image  does not have sub-byte pixels, these options have no effect other than to set\nthe value of the FILLORDER tag in the Tiff image (which may be useful for those programs that\nmisinterpret the tag with reference to 16 bit samples).\n\n\nThe  -rowsperstrip  option can be used to set the number of rows (scanlines) in each strip of\ndata in the output file.  By default, the output file has the number of rows per strip set to\na value that will ensure each strip is no more than 8 kilobytes long.\n\nThe -minisblack and -miniswhite option force the output image to have a \"minimum is black\" or\n\"minimum is white\" photometric, respectively.  If you don't specify  either,  pnmtotiff  uses\nminimum  is  black  except when using Group 3 or Group 4 compression, in which case pnmtotiff\nfollows CCITT fax standards and uses \"minimum is white.\"  This usually results in better com‐\npression and is generally preferred for bilevel coding.\n\nBefore  February 2001, pnmtotiff always produced \"minimum is black,\" due to a bug.  In either\ncase, pnmtotiff sets the photometric interpretation tag in the TIFF output according to which\nphotometric is actually used.\n\n#### -truecolor\n\ncolor TIFF image.  Without this option, pnmtotiff produces  a  colormapped  (paletted)  8-bit\nTIFF image unless there are more than 256 colors (and in the latter case, issues a warning).\n\nThe  -truecolor  option  can prevent pnmtotiff from making two passes through the input file,\nthus improving speed and memory usage.  See the section MULTIPLE PASSES.\n\nIf pnmtotiff produces a grayscale TIFF image, this option has no effect.\n\n#### -color\n\nis  PPM,  even if it contains only shades of gray.  Without this option, pnmtotiff produces a\ngrayscale TIFF image if 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 input, pnmtotiff always\nproduces grayscale TIFF output and this option has no effect.\n\nThe -color option can prevent pnmtotiff from making two passes through the input  file,  thus\nimproving speed and memory usage.  See the section MULTIPLE PASSES.\n\nThe  -indexbits option is meaningful only for a colormapped (paletted) image. In this kind of\nimage, the raster contains values which are indexes into a table of colors, with the  indexes\nnormally  taking  less  space 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 programs  that  inter‐\npret TIFF images can't handle any other width.\n\n### NOTES\n\nThere  are  myriad  variations  of  the TIFF format, and this program generates only a few of\nthem.  pnmtotiff creates a grayscale TIFF file if its input is  a  PBM  (monochrome)  or  PGM\n(grayscale)  file.   pnmtotiff  also creates a grayscale file if it input is PPM (color), but\nthere is only one color in the image.  If the input is a PPM (color) file and there  are  256\ncolors  or  fewer,  but more than 1, pnmtotiff generates a color palette TIFF file.  If there\nare more colors than that, pnmtotiff generates an RGB (not RGBA) single plane TIFF file.  Use\npnmtotiffcmyk to generate the cyan-magenta-yellow-black ink color separation TIFF format.\n\nThe  number  of bits per sample in the TIFF output is determined by the maxval of the PNM in‐\nput.  If the maxval is less than 256, the bits per sample in the output is the smallest  num‐\nber  that can encode the maxval.  If the maxval is greater than or equal to 256, there are 16\nbits per sample in the output.\n\n#### Multiple Passes\n\npnmtotiff reads the input image once if it can, and otherwise twice.  It  needs  that  second\npass  to analyze the colors in the image and generate a color map (pallette) and determine if\nthe image is grayscale.  So the second pass only happens when the input is PPM.  And you  can\navoid it 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, the second pass is\nvery fast.  If not, it requires reading from disk twice, which can be slow.\n\nWhen the input is from a file that cannot be rewound and reread, pnmtotiff reads  the  entire\ninput  image into a temporary file which can, and works from that.  Even if it only needs one\npass.\n\n### SEE ALSO\n\ntifftopnm(1), pnmtotiffcmyk(1), pnmdepth(1), pnm(5)\n\n### AUTHOR\n\nDerived by Jef Poskanzer from ras2tiff.c, which is Copyright (c) 1990  by  Sun  Microsystems,\nInc.  Author: Patrick J. Naughton (naughton@wind.sun.com).\n\n\n\n24 January 2001                              pnmtotiff(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "pnmtotiff",
        "section": "1",
        "mode": "man",
        "summary": "pnmtotiff - convert a portable anymap into a TIFF file",
        "synopsis": "pnmtotiff  [-none|-packbits|-lzw|-g3|-g4]  [-2d]  [-fill]  [-predictor n] [-msb2lsb|-lsb2msb]\n[-rowsperstrip n] [-minisblack|-miniswhite] [-truecolor] [-color] [-indexbits 1|2|4|8]  [pnm‐\nfile]\nMinimum unambiguous abbreviations of options are acceptable.",
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "option is only meaningful with LZW compression: a predictor value of 2 causes each scanline of the output image to undergo horizontal differencing before it is encoded; a value of 1 forces each scanline to be encoded without differencing. By default, pnmtotiff creates a TIFF file with msb-to-lsb fill order. The -msb2lsb and"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "file. The fill order is the order in which pixels are packed into a byte in the Tiff raster, in the case that there are multiple pixels per byte. msb-to-lsb means that the leftmost columns go into the most significant bits of the byte in the Tiff image. However, there is considerable confusion about the meaning of fill order. Some believe it means whether 16 bit sample val‐ ues in the Tiff image are little-endian or big-endian. This is totally erroneous (The endi‐ anness of integers in a Tiff image is designated by the image's magic number). However, ImageMagick and older Netpbm both have been known to implement that interpretation. 2001.09.06. If the image does not have sub-byte pixels, these options have no effect other than to set the value of the FILLORDER tag in the Tiff image (which may be useful for those programs that misinterpret the tag with reference to 16 bit samples). The -rowsperstrip option can be used to set the number of rows (scanlines) in each strip of data in the output file. By default, the output file has the number of rows per strip set to a value that will ensure each strip is no more than 8 kilobytes long. The -minisblack and -miniswhite option force the output image to have a \"minimum is black\" or \"minimum is white\" photometric, respectively. If you don't specify either, pnmtotiff uses minimum is black except when using Group 3 or Group 4 compression, in which case pnmtotiff follows CCITT fax standards and uses \"minimum is white.\" This usually results in better com‐ pression and is generally preferred for bilevel coding. Before February 2001, pnmtotiff always produced \"minimum is black,\" due to a bug. In either case, pnmtotiff sets the photometric interpretation tag in the TIFF output according to which photometric is actually used."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "color TIFF image. Without this option, pnmtotiff produces a colormapped (paletted) 8-bit TIFF image unless there are more than 256 colors (and in the latter case, issues a warning). The -truecolor option can prevent pnmtotiff from making two passes through the input file, thus improving speed and memory usage. See the section MULTIPLE PASSES. If pnmtotiff produces a grayscale TIFF image, this option has no effect."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "is PPM, even if it contains only shades of gray. Without this option, pnmtotiff produces a grayscale TIFF image if the input is PPM and contains only shades of gray, and at most 256 shades. Otherwise, it produces a color TIFF output. For PBM and PGM input, pnmtotiff always produces grayscale TIFF output and this option has no effect. The -color option can prevent pnmtotiff from making two passes through the input file, thus improving speed and memory usage. See the section MULTIPLE PASSES. The -indexbits option is meaningful only for a colormapped (paletted) image. In this kind of image, the raster contains values which are indexes into a table of colors, with the indexes normally taking less space that the color description in the table. pnmtotiff can generate indexes of 1, 2, 4, or 8 bits. By default, it will use 8, because many programs that inter‐ pret TIFF images can't handle any other width."
            }
        ],
        "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"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 15,
                "subsections": [
                    {
                        "name": "-fill -predictor",
                        "lines": 5
                    },
                    {
                        "name": "-lsb2msb",
                        "lines": 30
                    },
                    {
                        "name": "-truecolor",
                        "lines": 8
                    },
                    {
                        "name": "-color",
                        "lines": 15
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 14,
                "subsections": [
                    {
                        "name": "Multiple Passes",
                        "lines": 13
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 6,
                "subsections": []
            }
        ]
    }
}