{
    "mode": "man",
    "parameter": "pamtopng",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/man/pamtopng/json",
    "generated": "2026-10-05T10:52:03Z",
    "synopsis": "pamtopng [-verbose] [-transparent=color] [-background=color] [-gamma=value] [-chroma='wx wy\nrx ry gx gy bx by'] [-srgbintent=intent] [-time=[yy]yy-mm-dd\nhh:mm:ss] [-text=file] [-ztxt=file] [-itxt=file] [-interlace] [pnmfile]",
    "sections": {
        "NAME": {
            "content": "pamtopng - convert a Netpbm image to PNG\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "pamtopng [-verbose] [-transparent=color] [-background=color] [-gamma=value] [-chroma='wx wy\nrx ry gx gy bx by'] [-srgbintent=intent] [-time=[yy]yy-mm-dd\nhh:mm:ss] [-text=file] [-ztxt=file] [-itxt=file] [-interlace] [pnmfile]\n\n",
            "subsections": []
        },
        "OPTION USAGE": {
            "content": "Minimum unique abbreviation of option is acceptable.  You may use double hyphens instead of a\nsingle hyphen to denote options.  You may use white space in place of the equals sign to sep‐\narate an option name from its value.\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\npamtopng reads a Netpbm image as input and produces a PNG image as output.\n\nColor component values in PNG files are either 8 or 16 bits wide, so where necessary pamtopng\nscales  colors  to have a maxval of 255 or 65535.  In that case, it will add an sBIT chunk to\nindicated the original bit-depth.\n\npamtopng works only on images with maxval 1, 3, 15, 255, or 65535.  You can use  pamdepth  to\nconvert an image with some other maxval to one of these.\n\npamtopng  produces  a  color  PNG  from a color PAM, even if the only colors in the image are\nshades of gray.  To create a graycale PNG, from  such  an  image  (which  might  be  slightly\nsmaller), you can use other Netpbm programs to convert the input to grayscale.\n\n",
            "subsections": [
                {
                    "name": "Alternative: pnmtopng",
                    "content": "Netpbm  contains  another  program  for  generating PNG images: pnmtopng.  pnmtopng is a much\nolder program - it is in fact the first program in the world that could generate a PNG.  pnm‐\ntopng is a complex, feature-laden program.  It lets you control various arcane aspects of the\nconversion and create PNGs with various arcane features.  It does various transformations  on\nthe image to create the greatest compression possible, to a degree that probably doesn't make\nany difference in the modern world.\n\nThe  main  advantage  pamtopng  has over pnmtopng is that the former can use the transparency\nchannel of a PAM image to generate the transparency information in  the  PNG.   In  contrast,\nhandling of the alpha channel is very cumbersome with pnmtopng.\n\nOne  difference that does not exist, that some people might incorrectly infer from the names,\nis the possible input formats.  Both programs can take PBM, PGM, PPM, and PAM input.\n\nBecause pnmtopng has been around virtually forever, programs and procedures that use  it  are\nmore  portable  than  those  that use pamtopng.  Its age and popularity also probably make it\nhave fewer bugs.\n\npamtopng does not have any way to do what the following do in pnmtopng:\n\n\n\n•      -palette\n\n•      -history\n\n•      -filter\n\n•      -size\n\n•      -paeth\n\n•      -hist\n\n•      -nofilter\n\n•      -sub\n\n•      -up\n\n•      -avg\n\n•      -force\n\n•      -libversion\n\n•      -compression\n\n•      -compxxx\n\n\nThese are some of the other functions of pnmtopng that pamtopng lacks:\n\n\n\n•      When you specify a transparent or background color that is not in the image,  pnmtopng\ncan  optionally choose the closest one that is in the image.  pamtopng always uses the\nexact color you specify.\n\n\nFeatures that exist in both programs are controlled by largely the same command syntax.   But\nthere are these differences:\n\n\n\n•      pnmtopng's  -rgb option is -chroma in pamtopng.  -chroma is a better name, and in fact\nwas the name that pnmtopng used originally, but we had to change it  when  we  had  to\nchange the syntax of the option value to conform to the rest of Netpbm.\n\n\n•      pnmtopng's  -modtime option is -time in pamtopng.  The origin of -modtime is analogous\nto that of -rgb.\n\n\n\n\n"
                }
            ]
        },
        "OPTIONS": {
            "content": "In addition to the options common to all programs based on libnetpbm  (most  notably  -quiet,\nsee  Common Options ), pamtopng recognizes the following command line options:\n\n\n\n",
            "subsections": [
                {
                    "name": "-transparent=_",
                    "content": "pamtopng  marks  the specified color as transparent in the PNG image -- Every pixel of\nthis color is fully transparent.  This causes pamtopng to include a tRNS chunk in  the\nimage identifying that color.\n\nSpecify  the  color  (color) as described for the argument of the pnmparsecolor() li‐\nbrary routine .  E.g. red or rgb:ff/00/0d.\n\n"
                },
                {
                    "name": "-background=_",
                    "content": "This causes pamtopng to create a background color chunk in the PNG output which can be\nused for subsequent transparency channel or transparent  color  conversions.   Specify\ncolor the same as for -transparent.\n\n\n\n"
                },
                {
                    "name": "-gamma=_",
                    "content": "This  causes pamtopng to create a gAMA chunk.  This information helps describe how the\ncolor values in the PNG must be interpreted.  Without the gAMA chunk, whatever  inter‐\nprets  the  PNG  must  get this information separately (or just assume something stan‐\ndard).  If your input is a true PPM or PGM image, you should specify -gamma=.45.   But\nsometimes people generate images which are ostensibly PPM except the image uses a dif‐\nferent  gamma transfer function than the one specified for PPM.  A common case of this\nis when the image is created by simple hardware that  doesn't  have  digital  computa‐\ntional  ability.   Also,  some simple programs that generate images from scratch do it\nwith a gamma transfer in which the gamma value is 1.0.\n\n\n\n"
                },
                {
                    "name": "-chroma=_",
                    "content": "This option specifies how red, green, and blue component values of a pixel  specify  a\nparticular  color, by telling the chromaticities of those 3 primary illuminants and of\nwhite (i.e. full strength of all three).\n\nThe chromalist value is a blank-separated list of 8 floating point  decimal  numbers:\nthe  CIE-1931 X and Y chromaticities (in that order) of each of white, red, green, and\nblue, in that order.\n\nThis information goes into the PNG's cHRM chunk.\n\nIn a shell command,  make  sure  you  use  quotation  marks  so  that  the  blanks  in\nchromalist don't make the shell see multiple command arguments.\n\n"
                },
                {
                    "name": "-srgbintent=_",
                    "content": "This  asserts  that  the  input is a pseudo-Netpbm image that uses an sRGB color space\n(unlike true Netpbm) and indicates how you intend for the colors to be  rendered.   It\ncauses  pamtopng to include an sRGB chunk in the PNG image that specifies that intent,\nso see the PNG documentation for more information on what this really means.\n\nintent is one of:\n\n\n\n•      perceptual\n\n•      relativecolorimetric\n\n•      saturation\n\n•      absolutecolorimetric\n\n\n"
                },
                {
                    "name": "-text=_",
                    "content": "This option lets you include arbitrary text strings in the PNG output, as tEXt chunks.\n\nfilename is the name of a file that contains your text strings.\n\nThe output contains a distinct tEXt chunk for each entry in the file.\n\nHere is an example of a text string file:\n\nTitle           PNG file\nAuthor          John Doe\nDescription     how to include a text chunk\nPNG file\n\"Creation Date\" 2015-may-11\nSoftware        pamtopng\n\n\nThe file is divided into entries, each entry comprising  consecutive  lines  of  text.\nThe  first  line  of an entry starts in the first column (i.e. the first column is not\nwhite space) and every other line has white space in the first column.  The first  en‐\ntry  starts  in  the  first line, so it is not valid for the first line of the file to\nhave white space in its first column.\n\nThe first word in an entry is the key of the text string (e.g. 'Title').  It begins in\ncolumn one of the line and continues up to, but not  including,  the  first  delimiter\ncharacter or the end of the line, whichever is first.  You can enclose the key in dou‐\nble  quotes  in which case the key can consists of multiple words.  The quotes are not\npart of the key.  The text string per se begins after the key and any delimiter  char‐\nacters after it, plus the text in subsequent continuation lines.\n\nThere  is no limit on the length of a file line or entry or key or text string.  There\nis no limit on the number of entries.\n\n"
                },
                {
                    "name": "-ztxt=_",
                    "content": "The same as -text, except the text string is compressed in the PNG  output.   pamtopng\nuses zTXt chunks instead of a tEXt chunks.\n\n\n\n"
                },
                {
                    "name": "-itxt=_",
                    "content": "Similar  to  -text, but the text strings can be in a language other than English.  The\nPNG image indicates what language that is and includes the text  string  key  both  in\nEnglish and that language.  pamtopng uses iTXt chunks instead of tEXt chunks.\n\nFor each record, you must specify the language and give the key both in English and in\nthe text string language.\n\nExample:\n\nLanguage        nl-NL  Taal             nl-NL\nTitle           nl-NL  Titel            PNG file\nAuthor          nl-NL  Auteur           Pietje Puk\nDescription     nl-NL  Omschrijving     Tekst in het Nederlands.\n\n\nThe   language   specification   is   based   on   the   ISO   639-1   standard,   see\nhttp://en.wikipedia.org/wiki/ListofISO639-1codes for the valid codes.  The  format\nis either a two character \"nl\" or an extended code like \"en-US\".\n\n"
                },
                {
                    "name": "-time='",
                    "content": "This  option allows you to specify the modification time value to be placed in the PNG\noutput.  You can specify the year parameter either as a two or four digit value.\n\n\n\n"
                },
                {
                    "name": "-interlace",
                    "content": "This causes the PNG file to be interlaced, in Adam7 format.  The interlaced format  is\none in which the raster data starts with a low-resolution representation of the entire\nimage, then continues with additional information for the entire image, then even more\ninformation,  etc.   In  Adam7 in particular, there are seven such passes of the whole\nimage.  This is useful when you are receiving the image over a slow communication line\nas someone is waiting to see it.  The simplest thing to do in that case  is  wait  for\nthe entire image to arrive and then display it instantly, but then the user is wasting\ntime  staring  at a blank space until the whole image arrives.  With the standard non-\ninterlaced format, the data arrives row-by-row starting at the top, so  the  displayer\ncould display each row of the image as it arrives and gradually paint down to the bot‐\ntom.   But  with an interlaced image, the displayer can start by showing a low-resolu‐\ntion version of the image, then gradually improve the display as more data arrives.\n\nWhen you specify this option, pamtopng must hold the entire image in memory  at  once,\nwhereas  without  it,  the  program holds only one raster row at a time.  If you don't\nhave enough memory for that, you might suffer extreme slowdowns or failure - not  just\nin  the  process  running  pamtopng, but potentially throughout the system that shares\nmemory with it.  pnmtopng does not have this limitation (it holds only one  row  at  a\ntime in memory even when generating an interlaced PNG).\n\nThis option was new in Netpbm 10.86 (March 2019).\n\n"
                },
                {
                    "name": "-verbose",
                    "content": "This causes the program to display various facts about the conversion.\n\n\n\n\n\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "pngtopam(1), pnmtopng(1), pam(1), pnm(1)\n\nFor information on the PNG format, see http://www.w3.org/TR/PNG/ , http://libpng.org/pub/png/\n, http://en.wikipedia.org/wiki/ListofISO639-1codes  and http://schaik.com/png/ .\n\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "pamtopng was new in Netpbm 10.70 (June 2015).\n\nBefore  pamtopng,  the  two  ways  to  create PNG images with Netpbm were pnmtopng and pamrg‐\nbatopng.  The history of the former is discussed above.  The latter was added  to  Netpbm  in\n2005 as a cheap way to fill a significant need that pnmtopng did not: the ability to turn the\nalpha channel in a PAM image into the alpha channel in a PNG image.\n\nHandling  of  the  alpha  channel with pnmtopng is very cumbersome (as was dealing with alpha\nchannels in general before the introduction of the PAM format).  pamrgbatopng could  do  what\npeople  wanted  with  the  alpha channel, but nothing else.  It was a very small program with\nliterally no command line options.\n\nThe goal in those days was eventually to expand pnmtopng to do the PAM alpha  channel  thing,\nrename  it to pamtopng, and retire pamrgbatopng.  But pnmtopng is such a complex program, be‐\ncause of its dizzying array of features and its need for backward compatibility, that  adding\nthat one capability to it was a daunting task and for ten years nobody attempted it.\n\nIn  2015, one of the authors of the original pnmtopng (from before it was even part of Netpbm\n-- a program that shared essentially no lines of code with pnmtopng of 2015) decided to go in\na different direction.  While many features of pnmtopng were pretty important and easy to im‐\nplement, many others were probably of no use in the modern world or at  least  not  important\nenough to justify the complexity they lent to the code.  (The features thought to be outdated\nwere ones that were intended to make the PNG output slightly smaller - something considerably\nless important with the declining cost of computer resources).\n\nAnd there was an opportunity to drop those features: We could use the new name 'pamtopng' for\na  new  program, keep the existing program under the name 'pnmtopng', and avoid most backward\ncompatibility trouble.\n\nTherefore, Willem van Schaik wrote an intermediate level program that had all the most impor‐\ntant features of pnmtopng, plus the alpha channel handling of pamrgbatopng, with nice, simple\ncode.  That was pamtopng.\n\nBecause pamrgbatopng had no options, pamtopng was backward compatible with  it  without  even\ntrying.   Therefore, as soon as we added pamtopng to Netpbm, we removed pamrgbatopng and rec‐\nommended that pamrgbatopng be installed as an alias for pamtopng.\n\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.  Copyright  (C)  2015  by\nWillem van Schaik.\n",
            "subsections": []
        },
        "DOCUMENT SOURCE": {
            "content": "This  manual  page  was  generated by the Netpbm tool 'makeman' from HTML source.  The master\ndocumentation is at\n\nhttp://netpbm.sourceforge.net/doc/pamtopng.html\n\nnetpbm documentation                        13 March 2019                    Pamtopng User Manual(1)",
            "subsections": []
        }
    },
    "summary": "pamtopng - convert a Netpbm image to PNG",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "pamtopng marks the specified color as transparent in the PNG image -- Every pixel of this color is fully transparent. This causes pamtopng to include a tRNS chunk in the image identifying that color. Specify the color (color) as described for the argument of the pnmparsecolor() li‐ brary routine . E.g. red or rgb:ff/00/0d."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This causes pamtopng to create a background color chunk in the PNG output which can be used for subsequent transparency channel or transparent color conversions. Specify color the same as for -transparent."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This causes pamtopng to create a gAMA chunk. This information helps describe how the color values in the PNG must be interpreted. Without the gAMA chunk, whatever inter‐ prets the PNG must get this information separately (or just assume something stan‐ dard). If your input is a true PPM or PGM image, you should specify -gamma=.45. But sometimes people generate images which are ostensibly PPM except the image uses a dif‐ ferent gamma transfer function than the one specified for PPM. A common case of this is when the image is created by simple hardware that doesn't have digital computa‐ tional ability. Also, some simple programs that generate images from scratch do it with a gamma transfer in which the gamma value is 1.0."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option specifies how red, green, and blue component values of a pixel specify a particular color, by telling the chromaticities of those 3 primary illuminants and of white (i.e. full strength of all three). The chromalist value is a blank-separated list of 8 floating point decimal numbers: the CIE-1931 X and Y chromaticities (in that order) of each of white, red, green, and blue, in that order. This information goes into the PNG's cHRM chunk. In a shell command, make sure you use quotation marks so that the blanks in chromalist don't make the shell see multiple command arguments."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This asserts that the input is a pseudo-Netpbm image that uses an sRGB color space (unlike true Netpbm) and indicates how you intend for the colors to be rendered. It causes pamtopng to include an sRGB chunk in the PNG image that specifies that intent, so see the PNG documentation for more information on what this really means. intent is one of: • perceptual • relativecolorimetric • saturation • absolutecolorimetric"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option lets you include arbitrary text strings in the PNG output, as tEXt chunks. filename is the name of a file that contains your text strings. The output contains a distinct tEXt chunk for each entry in the file. Here is an example of a text string file: Title PNG file Author John Doe Description how to include a text chunk PNG file \"Creation Date\" 2015-may-11 Software pamtopng The file is divided into entries, each entry comprising consecutive lines of text. The first line of an entry starts in the first column (i.e. the first column is not white space) and every other line has white space in the first column. The first en‐ try starts in the first line, so it is not valid for the first line of the file to have white space in its first column. The first word in an entry is the key of the text string (e.g. 'Title'). It begins in column one of the line and continues up to, but not including, the first delimiter character or the end of the line, whichever is first. You can enclose the key in dou‐ ble quotes in which case the key can consists of multiple words. The quotes are not part of the key. The text string per se begins after the key and any delimiter char‐ acters after it, plus the text in subsequent continuation lines. There is no limit on the length of a file line or entry or key or text string. There is no limit on the number of entries."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The same as -text, except the text string is compressed in the PNG output. pamtopng uses zTXt chunks instead of a tEXt chunks."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Similar to -text, but the text strings can be in a language other than English. The PNG image indicates what language that is and includes the text string key both in English and that language. pamtopng uses iTXt chunks instead of tEXt chunks. For each record, you must specify the language and give the key both in English and in the text string language. Example: Language nl-NL Taal nl-NL Title nl-NL Titel PNG file Author nl-NL Auteur Pietje Puk Description nl-NL Omschrijving Tekst in het Nederlands. The language specification is based on the ISO 639-1 standard, see http://en.wikipedia.org/wiki/ListofISO639-1codes for the valid codes. The format is either a two character \"nl\" or an extended code like \"en-US\"."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option allows you to specify the modification time value to be placed in the PNG output. You can specify the year parameter either as a two or four digit value."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This causes the PNG file to be interlaced, in Adam7 format. The interlaced format is one in which the raster data starts with a low-resolution representation of the entire image, then continues with additional information for the entire image, then even more information, etc. In Adam7 in particular, there are seven such passes of the whole image. This is useful when you are receiving the image over a slow communication line as someone is waiting to see it. The simplest thing to do in that case is wait for the entire image to arrive and then display it instantly, but then the user is wasting time staring at a blank space until the whole image arrives. With the standard non- interlaced format, the data arrives row-by-row starting at the top, so the displayer could display each row of the image as it arrives and gradually paint down to the bot‐ tom. But with an interlaced image, the displayer can start by showing a low-resolu‐ tion version of the image, then gradually improve the display as more data arrives. When you specify this option, pamtopng must hold the entire image in memory at once, whereas without it, the program holds only one raster row at a time. If you don't have enough memory for that, you might suffer extreme slowdowns or failure - not just in the process running pamtopng, but potentially throughout the system that shares memory with it. pnmtopng does not have this limitation (it holds only one row at a time in memory even when generating an interlaced PNG). This option was new in Netpbm 10.86 (March 2019)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This causes the program to display various facts about the conversion."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "pngtopam",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pngtopam/1/json"
        },
        {
            "name": "pnmtopng",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmtopng/1/json"
        },
        {
            "name": "pam",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pam/1/json"
        },
        {
            "name": "pnm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Convert a PAM image to PNG.",
        "examples": [
            {
                "description": "Convert the specified PAM image to PNG",
                "command": "pamtopng {{path/to/image.pam}} > {{path/to/output.png}}"
            },
            {
                "description": "Mark the specified color as transparent in the output image",
                "command": "pamtopng {{-t|-transparent}} {{color}} {{path/to/image.pam}} > {{path/to/output.png}}"
            },
            {
                "description": "Include the text in the specified file as tEXt chunks in the output",
                "command": "pamtopng {{-te|-text}} {{path/to/file.txt}} {{path/to/image.pam}} > {{path/to/output.png}}"
            },
            {
                "description": "Cause the output file to be interlaced in Adam7 format",
                "command": "pamtopng {{-in|-interlace}} {{path/to/image.pam}} > {{path/to/output.png}}"
            }
        ]
    }
}