{
    "mode": "man",
    "parameter": "jpegtopnm",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/jpegtopnm/1/json",
    "generated": "2026-06-15T10:32:56Z",
    "synopsis": "jpegtopnm [-dct {int|fast|float}] [-nosmooth] [-maxmemory N] [{-adobe|-notadobe}] [-comments]\n[-dumpexif] [-exif=filespec] [-verbose] [-tracelevel N] [ filename ]\nAll options may be abbreviated to their shortest unique prefix.",
    "sections": {
        "NAME": {
            "content": "jpegtopnm - convert JPEG/JFIF file to portable pixmap or graymap\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "jpegtopnm [-dct {int|fast|float}] [-nosmooth] [-maxmemory N] [{-adobe|-notadobe}] [-comments]\n[-dumpexif] [-exif=filespec] [-verbose] [-tracelevel N] [ filename ]\n\nAll options may be abbreviated to their shortest unique prefix.\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "jpegtopnm converts the named JFIF file, or the standard input if no file is named to a PPM or\nPGM  image  file on the standard output.  If the JFIF file is of the grayscale variety, jpeg‐‐\ntopnm generates a PGM (Portable Graymap) file.   Otherwise,  it  generates  a  PPM  (Portable\nPixmap) file.\n\njpegtopnm  uses  the  Independent JPEG Group's JPEG library to interpret the input file.  See\nhttp://www.ijg.org for information on the library.\n\n\"JFIF\" is the correct name for the image format commonly known as \"JPEG.\"  Strictly speaking,\nJPEG  is a method of compression.  The image format using JPEG compression that is by far the\nmost common is JFIF.  There is also a subformat of TIFF that uses JPEG compression.\n\nEXIF is an image format that is a subformat of JFIF (to wit, a JFIF  file  that  contains  an\nEXIF header as an APP1 marker).  jpegtopnm handles EXIF.\n\nJFIF  files can have either 8 bits per sample or 12 bits per sample.  The 8 bit variety is by\nfar the most common.  There are two versions of the IJG JPEG library.  One reads only  8  bit\nfiles  and the other reads only 12 bit files.  You must link the appropriate one of these li‐\nbraries with jpegtopnm.  Ordinarily, this means the library is in your shared library  search\npath when you run jpegtopnm.\n\njpegtopnm  generates output with either one byte or two bytes per sample depending on whether\nthe JFIF input has either 8 bits or 12 bits per sample.  You can use  pnmdepth  to  reduce  a\ntwo-byte-per-sample file to a one-byte-per-sample file if you need to.\n\nIf  the  JFIF  file  uses  the  CMYK or YCCK color space, the input does not actually contain\nenough information to know what color each pixel is.  To know what  color  a  pixel  is,  one\nwould have to know the properties of the inks to which the color space refers.  jpegtopnm in‐\nterprets the colors using the common transformation which assumes all  the  inks  are  simply\nsubtractive and linear.\n\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The options are only for advanced users:\n",
            "subsections": [
                {
                    "name": "-dct int",
                    "content": "Use integer DCT method (default).\n"
                },
                {
                    "name": "-dct fast",
                    "content": "Use fast integer DCT (less accurate).\n"
                },
                {
                    "name": "-dct float",
                    "content": "Use  floating-point  DCT method.  The float method is very slightly more accurate than\nthe int method, but is much slower unless your machine has  very  fast  floating-point\nhardware.   Also  note  that  results  of  the floating-point method may vary slightly\nacross machines, while the integer methods should give the  same  results  everywhere.\nThe fast integer method is much less accurate than the other two.\n"
                },
                {
                    "name": "-nosmooth",
                    "content": "Use a faster, lower-quality upsampling routine.\n"
                },
                {
                    "name": "-maxmemory",
                    "content": "Set limit on the amount of memory jpegtopnm uses in processing large images.  Value is\nin thousands of bytes, or millions of bytes if \"M\" is suffixed to the number.  For ex‐\nample,  -maxmemory  4m  selects 4000000 bytes.  If jpegtopnm needs more space, it uses\ntemporary files.\n"
                },
                {
                    "name": "-adobe",
                    "content": ""
                },
                {
                    "name": "-notadobe",
                    "content": "There are two variations on the CMYK (and likewise YCCK) color space that may be  used\nin  the  JFIF input.  In the normal one, a zero value for a color components indicates\nabsence of ink.  In the other, a zero value means the maximum ink coverage.  The  lat‐\nter  is  used by Adobe Photoshop when it creates a bare JFIF output file (but not when\nit creates JFIF output as part of Encapsulated Postscript output).\n\nThese options tell jpegtopnm which version of the CMYK or YCCK color space  the  image\nuses.   If  you  specify neither, jpegtopnm tries to figure it out on its own.  In the\npresent version, it doesn't try very hard at all: It just assumes the  Photoshop  ver‐\nsion,  since  Photoshop  and its emulators seem to be the main source of CMYK and YCCK\nimages.  But with experience of use, future versions might be more sophisticated.\n\nIf the JFIF image does not indicate that it is CMYK or YCCK, these options have no ef‐\nfect.\n\nIf you don't use the right one of these options, the symptom is output that looks like\na negative.\n\n"
                },
                {
                    "name": "-dumpexif",
                    "content": "Print the interpreted contents of any Exif header in the input file  to  the  Standard\nError file.  Similar to the program jhead (not part of the Netpbm package).\n"
                },
                {
                    "name": "-exif=",
                    "content": "Extract  the contents of the EXIF header from the input image and write it to the file\nfilespec.  filespec = - means write it to Standard Output.  In  this  case,  jpegtopnm\ndoes not output the converted image at all.\n\njpegtopnm  writes the contents of the EXIF header byte-for-byte, starting with the two\nbyte length field (which length includes those two bytes).\n\nYou can use this file as input to ppmtojpeg to insert an identical EXIF header into  a\nnew JFIF image.\n\nIf  there  is  no  EXIF  header, jpegtopnm writes two bytes of binary zero and nothing\nelse.\n\nAn EXIF header takes the form of a JFIF APP1  marker.   Only  the  first  such  marker\nwithin the JFIF header counts.\n\n"
                },
                {
                    "name": "-comments",
                    "content": "Print any comments in the input file to the Standard Error file.\n"
                },
                {
                    "name": "-verbose",
                    "content": "Print details about the conversion to the Standard Error file.\n"
                },
                {
                    "name": "-tracelevel",
                    "content": "Turn  on the JPEG library's trace messages to the Standard Error file.  A higher value\nof n gets more trace information.  -verbose implies a trace level of at least 1.\n\n"
                }
            ]
        },
        "EXAMPLES": {
            "content": "This example converts the color JFIF file foo.jpg to a PPM file named foo.ppm:\n\njpegtopnm foo.jpg >foo.ppm\n\n",
            "subsections": []
        },
        "HINTS": {
            "content": "You can use ppmquant to color quantize the result, i.e. to reduce the number of distinct col‐\nors  in  the  image.  In fact, you may have to if you want to convert the PPM file to certain\nother formats.  ppmdither Does a more sophisticated quantization.\n\nUse pnmscale to change the dimensions of the resulting image.\n\nUse ppmtopgm to convert a color JFIF file to a grayscale PGM file.\n\nYou can easily use these converters together.  E.g.:\n\njpegtopnm foo.jpg | ppmtopgm | pnmscale .25\n>foo.pgm\n",
            "subsections": [
                {
                    "name": "-dct -nosmooth",
                    "content": "If you are fortunate enough to have very fast floating point hardware, -dct float may be even\nfaster than -dct fast.  But on most machines -dct float is slower than -dct int; in this case\nit is not worth using, because its theoretical accuracy advantage is too small to be signifi‐\ncant in practice.\n\nAnother  program,  djpeg,  is similar.  djpeg is maintained by the Independent JPEG Group and\npackaged with the JPEG library which jpegtopnm uses for all its JPEG work.  Because of  that,\nyou  may  expect  it to exploit more current JPEG features.  Also, since you have to have the\nlibrary to run jpegtopnm, but not vice versa, cjpeg may be more commonly available.\n\nOn the other hand, djpeg does not use the NetPBM libraries to generate its output, as all the\nNetPBM  tools  such  as jpegtopnm do.  This means it is less likely to be consistent with all\nthe other programs that deal with the NetPBM formats.  Also, the command syntax of  jpegtopnm\nis consistent with that of the other Netpbm tools, unlike djpeg.\n\n"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "JPEGMEM\nIf this environment variable is set, its value is the default memory limit.  The value\nis specified as described for the -maxmemory option.  An  explicit  -maxmemory  option\noverrides any JPEGMEM.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ppm(5),  pgm(5),  ppmtojpeg(1),  ppmquant(1),  pnmscale(1),  ppmtopgm(1),  ppmdither(1),  pn‐‐\nmdepth(1),\ndjpeg(1), cjpeg(1), jpegtran(1), rdjpgcom(1), wrjpgcom(1), jhead(1)\nWallace, Gregory K.  \"The JPEG Still Picture Compression  Standard\",  Communications  of  the\nACM, April 1991 (vol. 34, no. 4), pp. 30-44.\n\n",
            "subsections": []
        },
        "LIMITATIONS": {
            "content": "Arithmetic coding is not supported for legal reasons.\n\nThe program could be much faster.\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "jpegtopnm  and  this  man page were derived in large part from djpeg, by the Independent JPEG\nGroup.  The program is otherwise by Bryan Henderson on March 19, 2000.\n\n\n\n\n19 March 2000                               JPEGTOPNM(1)",
            "subsections": []
        }
    },
    "summary": "jpegtopnm - convert JPEG/JFIF file to portable pixmap or graymap",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use integer DCT method (default)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use fast integer DCT (less accurate)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use floating-point DCT method. The float method is very slightly more accurate than the int method, but is much slower unless your machine has very fast floating-point hardware. Also note that results of the floating-point method may vary slightly across machines, while the integer methods should give the same results everywhere. The fast integer method is much less accurate than the other two."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use a faster, lower-quality upsampling routine."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Set limit on the amount of memory jpegtopnm uses in processing large images. Value is in thousands of bytes, or millions of bytes if \"M\" is suffixed to the number. For ex‐ ample, -maxmemory 4m selects 4000000 bytes. If jpegtopnm needs more space, it uses temporary files."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "There are two variations on the CMYK (and likewise YCCK) color space that may be used in the JFIF input. In the normal one, a zero value for a color components indicates absence of ink. In the other, a zero value means the maximum ink coverage. The lat‐ ter is used by Adobe Photoshop when it creates a bare JFIF output file (but not when it creates JFIF output as part of Encapsulated Postscript output). These options tell jpegtopnm which version of the CMYK or YCCK color space the image uses. If you specify neither, jpegtopnm tries to figure it out on its own. In the present version, it doesn't try very hard at all: It just assumes the Photoshop ver‐ sion, since Photoshop and its emulators seem to be the main source of CMYK and YCCK images. But with experience of use, future versions might be more sophisticated. If the JFIF image does not indicate that it is CMYK or YCCK, these options have no ef‐ fect. If you don't use the right one of these options, the symptom is output that looks like a negative."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print the interpreted contents of any Exif header in the input file to the Standard Error file. Similar to the program jhead (not part of the Netpbm package)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Extract the contents of the EXIF header from the input image and write it to the file filespec. filespec = - means write it to Standard Output. In this case, jpegtopnm does not output the converted image at all. jpegtopnm writes the contents of the EXIF header byte-for-byte, starting with the two byte length field (which length includes those two bytes). You can use this file as input to ppmtojpeg to insert an identical EXIF header into a new JFIF image. If there is no EXIF header, jpegtopnm writes two bytes of binary zero and nothing else. An EXIF header takes the form of a JFIF APP1 marker. Only the first such marker within the JFIF header counts."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print any comments in the input file to the Standard Error file."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print details about the conversion to the Standard Error file."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Turn on the JPEG library's trace messages to the Standard Error file. A higher value of n gets more trace information. -verbose implies a trace level of at least 1."
        }
    ],
    "examples": [
        "This example converts the color JFIF file foo.jpg to a PPM file named foo.ppm:",
        "jpegtopnm foo.jpg >foo.ppm"
    ],
    "see_also": [
        {
            "name": "ppm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/ppm/5/json"
        },
        {
            "name": "pgm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pgm/5/json"
        },
        {
            "name": "ppmtojpeg",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtojpeg/1/json"
        },
        {
            "name": "ppmquant",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmquant/1/json"
        },
        {
            "name": "pnmscale",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmscale/1/json"
        },
        {
            "name": "ppmtopgm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtopgm/1/json"
        },
        {
            "name": "ppmdither",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmdither/1/json"
        },
        {
            "name": "mdepth",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mdepth/1/json"
        },
        {
            "name": "djpeg",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/djpeg/1/json"
        },
        {
            "name": "cjpeg",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/cjpeg/1/json"
        },
        {
            "name": "jpegtran",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/jpegtran/1/json"
        },
        {
            "name": "rdjpgcom",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/rdjpgcom/1/json"
        },
        {
            "name": "wrjpgcom",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/wrjpgcom/1/json"
        },
        {
            "name": "jhead",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/jhead/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Convert a JPEG/JFIF file to the PPM or PGM format.",
        "examples": [
            {
                "description": "Convert JPEG/JFIF image to a PPM or PGM image",
                "command": "jpegtopnm {{path/to/file.jpg}} > {{path/to/file.pnm}}"
            },
            {
                "description": "Display version",
                "command": "jpegtopnm {{-v|-version}}"
            }
        ]
    }
}