{
    "content": [
        {
            "type": "text",
            "text": "# jpegtopnm (man)\n\n## NAME\n\njpegtopnm - convert JPEG/JFIF file to PPM or PGM image\n\n## SYNOPSIS\n\njpegtopnm [-dct {int|fast|float}] [-nosmooth] [-maxmemory N] [{-adobe|-notadobe}] [-comments]\n[-dumpexif]  [-exif=filespec]  [-multiple]  [-repair] [-verbose] [-tracelevel N] [-traceexif]\n[filename]\nMinimum unique abbreviation of option is acceptable.  You may use double hyphens  instead  of\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## DESCRIPTION\n\nThis program is part of Netpbm(1).\n\n## TLDR\n\n> Convert a JPEG/JFIF file to the PPM or PGM format.\n\n- Convert JPEG/JFIF image to a PPM or PGM image:\n  `jpegtopnm {{path/to/file.jpg}} > {{path/to/file.pnm}}`\n- Display version:\n  `jpegtopnm {{-v|-version}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (15 subsections)\n- **EXAMPLES**\n- **HINTS** (1 subsections)\n- **ENVIRONMENT**\n- **SEE ALSO**\n- **AUTHOR**\n- **DOCUMENT SOURCE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "jpegtopnm",
        "section": "",
        "mode": "man",
        "summary": "jpegtopnm - convert JPEG/JFIF file to PPM or PGM image",
        "synopsis": "jpegtopnm [-dct {int|fast|float}] [-nosmooth] [-maxmemory N] [{-adobe|-notadobe}] [-comments]\n[-dumpexif]  [-exif=filespec]  [-multiple]  [-repair] [-verbose] [-tracelevel N] [-traceexif]\n[filename]\nMinimum unique abbreviation of option is acceptable.  You may use double hyphens  instead  of\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.",
        "tldr_summary": "Convert a JPEG/JFIF file to the PPM or PGM format.",
        "tldr_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}}"
            }
        ],
        "tldr_source": "official",
        "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). This option was added in Netpbm 9.19 (September 2001)."
            },
            {
                "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. When you write the EXIF header to Standard Output, jpegtopnm does not output the converted image (which is what normally would go to Standard Output) 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 pnmtojpeg 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. This option was added in Netpbm 9.19 (September 2001)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Read multiple JFIF images sequentially from the input stream. See \u001b]8;;#description\u001b\\Description section\u001b]8;;\u001b\\ for details. This option was new in Netpbm 10.23 (July 2004)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "If the JFIF input is invalid, try to salvage whatever information is there and produce a valid PNM image as output. Without this option, some invalid input causes jpegtopnm to fail, and what output it produces is undefined. With -repair such invalid input causes jpegtopnm to succeed instead. But note that there are some forms of invalid input that always cause jpegtopnm to fail and others that always cause it to salvage image information and succeed. One particular case where -repair makes a difference is the common case that the file is truncated somewhere after the JFIF header. Without -repair, that always causes a failure; with -repair it always causes success. Because the image information is laid out generally top to bottom in the JFIF stream, the image jpegtopnm produces in this case has the proper image contents at the top, but the bottom is padded with gray. This option was new in Netpbm 10.38.0 (March 2007). Before that, jpegtopnm always fails in the cases in question."
            },
            {
                "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."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Print trace information about the processing of EXIF header information. This option was new in Netpbm 11.02 (March 2023)."
            }
        ],
        "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": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ppm/1/json"
            },
            {
                "name": "pgm",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pgm/1/json"
            },
            {
                "name": "pnmtojpeg",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmtojpeg/1/json"
            },
            {
                "name": "pnmquant",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmquant/1/json"
            },
            {
                "name": "pamscale",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pamscale/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": "pamdepth",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pamdepth/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 56,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 7,
                "subsections": [
                    {
                        "name": "-dct int",
                        "lines": 3
                    },
                    {
                        "name": "-dct fast",
                        "lines": 3
                    },
                    {
                        "name": "-dct float",
                        "lines": 7
                    },
                    {
                        "name": "-nosmooth",
                        "lines": 2
                    },
                    {
                        "name": "-maxmemory _",
                        "lines": 6
                    },
                    {
                        "name": "-adobe",
                        "lines": 1
                    },
                    {
                        "name": "-notadobe",
                        "lines": 19
                    },
                    {
                        "name": "-dumpexif",
                        "lines": 6
                    },
                    {
                        "name": "-exif=_",
                        "lines": 20
                    },
                    {
                        "name": "-multiple",
                        "lines": 6
                    },
                    {
                        "name": "-repair",
                        "lines": 21
                    },
                    {
                        "name": "-comments",
                        "lines": 3
                    },
                    {
                        "name": "-verbose",
                        "lines": 3
                    },
                    {
                        "name": "-tracelevel _",
                        "lines": 4
                    },
                    {
                        "name": "-traceexif",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "HINTS",
                "lines": 13,
                "subsections": [
                    {
                        "name": "-dct fast  -nosmooth",
                        "lines": 16
                    }
                ]
            },
            {
                "name": "ENVIRONMENT",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DOCUMENT SOURCE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "jpegtopnm - convert JPEG/JFIF file to PPM or PGM image\n\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "jpegtopnm [-dct {int|fast|float}] [-nosmooth] [-maxmemory N] [{-adobe|-notadobe}] [-comments]\n[-dumpexif]  [-exif=filespec]  [-multiple]  [-repair] [-verbose] [-tracelevel N] [-traceexif]\n[filename]\n\nMinimum unique abbreviation of option is acceptable.  You may use double hyphens  instead  of\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\njpegtopnm converts JFIF images to PPM or PGM images.\n\nBy default, jpegtopnm expects the input stream to contain one JFIF image and produces one PGM\nor PPM image as output.  It fails if the input stream is empty.\n\nBut with the -multiple option, jpegtopnm reads JFIF images sequentially from the input stream\nand  writes  one  PPM  or  PGM  image to the output stream for each JFIF input.  If the input\nstream is empty, so is the output.\n\nThe input stream is the filename you specify or, if you don't specify filename, Standard  In‐\nput.  The output stream is Standard Output.\n\nIf  a  JFIF input image is of the grayscale variety, jpegtopnm generates a PGM image.  Other‐\nwise, it generates a PPM image.\n\nBefore Netpbm 10.11 (October 2002), jpegtopnm did not have the multiple image stream capabil‐\nity.  From 10.11 through 10.22, Netpbm always behaved as if you specified -multiple.   Start‐\ning  with  Netpbm 10.23 (July 2004), Netpbm's default behavior went back to the pre-10.11 be‐\nhavior and the new -multiple option selected the 10.12 behavior.  The reason for  the  rever‐\nsion  was  that there were discovered in the world files that contain JFIF images followed by\nsomething other than another JFIF image.  The producers of these files expect  them  to  work\nwith any JFIF interpreter because most JFIF interpreters just stop reading the file after the\nfirst JFIF image.\n\njpegtopnm  uses  the  Independent JPEG Group's JPEG library to interpret the input file.  See\n\u001b]8;;http://www.ijg.org\u001b\\http://www.ijg.org\u001b]8;;\u001b\\  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  pamdepth  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\nSee the jpegtopnm manual(1) for information on how images lose quality when  you  convert  to\nand from JFIF.\n\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "In  addition  to  the options common to all programs based on libnetpbm (most notably -quiet,\nsee \u001b]8;;index.html#commonoptions\u001b\\ Common Options\u001b]8;;\u001b\\ ), jpegtopnm recognizes the following command line options:\n\nThe options are only for advanced users.\n\n\n",
                "subsections": [
                    {
                        "name": "-dct int",
                        "content": "Use integer DCT method (default).\n\n"
                    },
                    {
                        "name": "-dct fast",
                        "content": "Use fast integer DCT (less accurate).\n\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\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\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\nThis option was added in Netpbm 9.19 (September 2001).\n\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.  When you write the EXIF\nheader to Standard Output, jpegtopnm does not output the  converted  image  (which  is\nwhat normally would go to Standard Output) 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 pnmtojpeg 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\nThis option was added in Netpbm 9.19 (September 2001).\n\n"
                    },
                    {
                        "name": "-multiple",
                        "content": "Read multiple JFIF images sequentially from the input stream.  See \u001b]8;;#description\u001b\\Description section\u001b]8;;\u001b\\\nfor details.\n\nThis option was new in Netpbm 10.23 (July 2004).\n\n"
                    },
                    {
                        "name": "-repair",
                        "content": "If the JFIF input is invalid, try to salvage whatever information is there and produce\na valid PNM image as output.\n\nWithout  this  option, some invalid input causes jpegtopnm to fail, and what output it\nproduces is undefined.  With -repair such invalid input causes  jpegtopnm  to  succeed\ninstead.\n\nBut  note  that  there  are some forms of invalid input that always cause jpegtopnm to\nfail and others that always cause it to salvage image information and succeed.\n\nOne particular case where -repair makes a difference is the common case that the  file\nis  truncated  somewhere after the JFIF header.  Without -repair, that always causes a\nfailure; with -repair it always causes success.  Because the image information is laid\nout generally top to bottom in the JFIF stream, the image jpegtopnm produces  in  this\ncase has the proper image contents at the top, but the bottom is padded with gray.\n\nThis  option  was  new  in Netpbm 10.38.0 (March 2007).  Before that, jpegtopnm always\nfails in the cases in question.\n\n\n"
                    },
                    {
                        "name": "-comments",
                        "content": "Print any comments in the input file to the Standard Error file.\n\n"
                    },
                    {
                        "name": "-verbose",
                        "content": "Print details about the conversion to the Standard Error file.\n\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"
                    },
                    {
                        "name": "-traceexif",
                        "content": "Print trace information about the processing of EXIF header information.\n\nThis option was new in Netpbm 11.02 (March 2023).\n\n\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\n",
                "subsections": []
            },
            "HINTS": {
                "content": "You can use pnmquant 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 pamscale 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 | pamscale .25 >foo.pgm\n\n",
                "subsections": [
                    {
                        "name": "-dct fast  -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\n\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "ppm(1),  pgm(1),   pnmtojpeg(1),   pnmquant(1),   pamscale(1),   ppmtopgm(1),   ppmdither(1),\npamdepth(1),\n\ndjpeg  man  page,  cjpeg  man  page, jpegtran man page, rdjpgcom man page, wrjpgcom man page,\njhead man page\n\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": []
            },
            "AUTHOR": {
                "content": "jpegtopnm  and  this  manual  were  derived in large part from djpeg, by the Independent JPEG\nGroup.  The program is otherwise by Bryan Henderson on March 19, 2000.\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/jpegtopnm.html\n\nnetpbm documentation                        20 March 2023                   Jpegtopnm User Manual(1)",
                "subsections": []
            }
        }
    }
}