{
    "content": [
        {
            "type": "text",
            "text": "# pamflip (man)\n\n## NAME\n\npamflip - flip or rotate a PAM or PNM image\n\n## SYNOPSIS\n\npamflip  {  -leftright | -lr | -topbottom | -tb | -transpose | -xy | -rotate90 | -r90 | -cw |\n\n## DESCRIPTION\n\nThis program is part of Netpbm(1).\n\n## TLDR\n\n> Flip or rotate a PAM or PNM image.\n\n- Rotate the input image counter-clockwise for a specific degree:\n  `pamflip {{-r|-rotate}}{{90|180|270}} {{path/to/input.pam}} > {{path/to/output.pam}}`\n- Flip left for right:\n  `pamflip {{-lr|-leftright}} {{path/to/input.pam}} > {{path/to/output.pam}}`\n- Flip top for bottom:\n  `pamflip {{-tb|-topbottom}} {{path/to/input.pam}} > {{path/to/output.pam}}`\n- Flip the input image on the main diagonal:\n  `pamflip {{-xy|-transpose}} {{path/to/input.pam}} > {{path/to/output.pam}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS** (1 subsections)\n- **DESCRIPTION**\n- **OPTIONS** (23 subsections)\n- **SEE ALSO**\n- **HISTORY**\n- **AUTHOR**\n- **DOCUMENT SOURCE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "pamflip",
        "section": "",
        "mode": "man",
        "summary": "pamflip - flip or rotate a PAM or PNM image",
        "synopsis": "pamflip  {  -leftright | -lr | -topbottom | -tb | -transpose | -xy | -rotate90 | -r90 | -cw |",
        "tldr_summary": "Flip or rotate a PAM or PNM image.",
        "tldr_examples": [
            {
                "description": "Rotate the input image counter-clockwise for a specific degree",
                "command": "pamflip {{-r|-rotate}}{{90|180|270}} {{path/to/input.pam}} > {{path/to/output.pam}}"
            },
            {
                "description": "Flip left for right",
                "command": "pamflip {{-lr|-leftright}} {{path/to/input.pam}} > {{path/to/output.pam}}"
            },
            {
                "description": "Flip top for bottom",
                "command": "pamflip {{-tb|-topbottom}} {{path/to/input.pam}} > {{path/to/output.pam}}"
            },
            {
                "description": "Flip the input image on the main diagonal",
                "command": "pamflip {{-xy|-transpose}} {{path/to/input.pam}} > {{path/to/output.pam}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "tent with the rest of Netpbm and most of the Unix world, and thus hard to understand and to implement)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "pamflip after computing the kind of transformation desired, including none at all). This option was new in Netpbm 10.13 (December 2002)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Apply all the transforms listed, in order. The valid values for the transforms are as follows and have the same meanings as the identically named options above. • leftright • topbottom • transpose This option was new in Netpbm 10.13 (December 2002)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "mebibytes is the size in mebibytes (aka megabytes) of memory available for pamflip. It is the lesser of the amount of real or virtual memory available. pamflip does nothing special to allocate real memory or control it's allocation -- it gets whatever it gets just by referencing virtual memory normally. The real memory figure in question is the maximum amount that pamflip can be expected to end up with by doing that. This is just about impossible for you to know, of course, but you can estimate. The total real memory in your system should be a major factor in your esti‐ mate. If pamflip cannot fit the entire image in the amount of memory you specify, it does the transformation in chunks, using temporary files for intermediate results. In strict horizontal transformations (left for right) or the null transformation, pam‐ flip never keeps more than one row in memory, so the memory size is irrelevant and pamflip doesn't use temporary files. In strict vertical transformations (top for bottom), even when you allow pamflip enough memory to keep the entire image in virtual memory, it accesses it in a single pass, which does not cause any thrashing; the chunks in temporary files thus don't help. The real memory is important when you do a column for row type of transformation (e.g. -rotate90). In that case, even if pamflip can fit the entire image in virtual memory at once, if it does not also fit in real memory, the program will thrash like crazy because of the order in which pamflip accesses the pixels, and that means it will take a ridiculously long time to run. A proper -memsize drastically reduces the paging. If you specify -memsize too large, pamflip may attempt to get more virtual memory than the system allows it and fail. If it can get the virtual memory, but -memsize is larger than the amount of real memory the system allows it and the transformation is row for column, it will page thrash and run very slowly. A value even slightly too high is the same as infinity. If you specify -memsize too small, the program will run slightly more slowly because of extra overhead in manipulating temporary files. Also, if your environment isn't set up to make temporary files possible, pamflip will fail. Doing the entire transformation \"in memory\" doesn't speed things up as much as you might think, because even with the temporary files, the data is just as likely to be in memory. Virtual memory gets paged to disk and disk files get cached in memory. In fact, the pixels fit much more compactly into memory when stored in a temporary file than when stored \"in memory\" because pamflip uses a more efficient format. So you're likely to have less disk I/O when you allow pamflip less memory. If you do not specify -memsize, pamflip assumes infinity. This option did not exist before Netpbm 10.7 (August 2002). Before Netpbm 10.42 (March 2008), this option applied only to real memory. pamflip would always keep the entire image in virtual memory and if it could not get enough virtual memory, it failed. pamflip accessed the pixels in an order designed to keep real memory use within the specified amount."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "bytes is the size in bytes of a paging unit -- the amount of memory that gets paged in or out as an indivisible unit -- in your system. The default is 4KiB. This option has no effect. Before Netpbm 10.42 (March 2008), pamflip used it to control its use of real memory. This option did not exist before Netpbm 10.7 (August 2002)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option causes pamflip to issue messages to Standard Error about its progress."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "pnmrotate",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmrotate/1/json"
            },
            {
                "name": "pnm",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnm/1/json"
            },
            {
                "name": "pam",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pam/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-rotate270  -r270  -ccw  -rotate180  -r180  -null   -xform=_ -mem‐",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 4,
                "subsections": [
                    {
                        "name": "Specifying the Transformation",
                        "lines": 5
                    },
                    {
                        "name": "-xform",
                        "lines": 5
                    },
                    {
                        "name": "-leftright",
                        "lines": 1
                    },
                    {
                        "name": "-lr",
                        "lines": 1
                    },
                    {
                        "name": "-topbottom",
                        "lines": 1
                    },
                    {
                        "name": "-tb",
                        "lines": 1
                    },
                    {
                        "name": "-transpose",
                        "lines": 1
                    },
                    {
                        "name": "-xy",
                        "lines": 1
                    },
                    {
                        "name": "-rotate90",
                        "lines": 1
                    },
                    {
                        "name": "-r90",
                        "lines": 1
                    },
                    {
                        "name": "-ccw",
                        "lines": 1
                    },
                    {
                        "name": "-rotate180",
                        "lines": 1
                    },
                    {
                        "name": "-r180",
                        "lines": 1
                    },
                    {
                        "name": "-rotate270",
                        "lines": 1
                    },
                    {
                        "name": "-r270",
                        "lines": 1
                    },
                    {
                        "name": "-cw",
                        "lines": 1
                    },
                    {
                        "name": "-null",
                        "lines": 5
                    },
                    {
                        "name": "-xform=_",
                        "lines": 16
                    },
                    {
                        "name": "Memory Management",
                        "lines": 10
                    },
                    {
                        "name": "-memsize=_",
                        "lines": 55
                    },
                    {
                        "name": "-pagesize=_",
                        "lines": 12
                    },
                    {
                        "name": "Miscellaneous",
                        "lines": 1
                    },
                    {
                        "name": "-verbose",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DOCUMENT SOURCE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "pamflip - flip or rotate a PAM or PNM image\n\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "pamflip  {  -leftright | -lr | -topbottom | -tb | -transpose | -xy | -rotate90 | -r90 | -cw |",
                "subsections": [
                    {
                        "name": "-rotate270  -r270  -ccw  -rotate180  -r180  -null   -xform=_ -mem‐",
                        "content": "size=mebibytes] [-pagesize=bytes] [pamfile]\n\nAll  options can be abbreviated to their shortest unique prefix.  You may use two hyphens in‐\nstead of one to designate an option.  You may use either white space or an  equals  sign  be‐\ntween an option name and its value.\n\n\n"
                    }
                ]
            },
            "DESCRIPTION": {
                "content": "This program is part of Netpbm(1).\n\npamflip  flips a PAM or PNM image top for bottom or left for right, or transposes it horizon‐\ntal for vertical, or rotates it 1, 2, or 3 quarter turns.\n\nTo rotate at other angles, use pnmrotate.  It is much slower, though.\n\nThe input image is pamfile, or Standard Input if pamfile is not specified.\n\nTo flip/rotate a JFIF (JPEG) image losslessly, use jpegtran.  jpegtran is part of  the  Inde‐\npendent  Jpeg Group's compression library package, not part of Netpbm.  The normal Netpbm way\nto flip a JFIF file would be to convert it to PNM, use pamflip, and  convert  back  to  JFIF.\nBut  since  JPEG  compression  is lossy, the resulting image would have less quality than the\noriginal.  jpegtran, on the other hand, can do this particular transformation directly on the\ncompressed data without loss.\n\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\\ ), pamflip recognizes the following command line options:\n\n",
                "subsections": [
                    {
                        "name": "Specifying the Transformation",
                        "content": "You must supply exactly one of the following options:\n\npamflip's  predecessor (before Netpbm 10.7 - August 2002) pnmflip did not have the -xform op‐\ntion and instead allowed you to specify any number of the other options, including zero.   It\napplied  all  the  indicated  transformations,  in  the order given, just like with pamflip's"
                    },
                    {
                        "name": "-xform",
                        "content": "tent  with  the rest of Netpbm and most of the Unix world, and thus hard to understand and to\nimplement).\n\n\n"
                    },
                    {
                        "name": "-leftright",
                        "content": ""
                    },
                    {
                        "name": "-lr",
                        "content": ""
                    },
                    {
                        "name": "-topbottom",
                        "content": ""
                    },
                    {
                        "name": "-tb",
                        "content": ""
                    },
                    {
                        "name": "-transpose",
                        "content": ""
                    },
                    {
                        "name": "-xy",
                        "content": ""
                    },
                    {
                        "name": "-rotate90",
                        "content": ""
                    },
                    {
                        "name": "-r90",
                        "content": ""
                    },
                    {
                        "name": "-ccw",
                        "content": ""
                    },
                    {
                        "name": "-rotate180",
                        "content": ""
                    },
                    {
                        "name": "-r180",
                        "content": ""
                    },
                    {
                        "name": "-rotate270",
                        "content": ""
                    },
                    {
                        "name": "-r270",
                        "content": ""
                    },
                    {
                        "name": "-cw",
                        "content": ""
                    },
                    {
                        "name": "-null",
                        "content": "pamflip after computing the kind of transformation desired, including none at all).\n\nThis option was new in Netpbm 10.13 (December 2002).\n\n"
                    },
                    {
                        "name": "-xform=_",
                        "content": "Apply all the transforms listed, in order.  The valid values for the transforms are as\nfollows and have the same meanings as the identically named options above.\n\n\n•      leftright\n\n•      topbottom\n\n•      transpose\n\n\nThis option was new in Netpbm 10.13 (December 2002).\n\n\n\n"
                    },
                    {
                        "name": "Memory Management",
                        "content": "The  following options help pamflip use memory efficiently.  Some flipping operations on very\nlarge images can cause pamflip to have a very large working set, which  means  if  you  don't\nhave  enough  real  memory,  the  program  can page thrash, which means it takes a ridiculous\namount time to run.  If your entire image fits in real memory, you don't have a problem.   If\nyou're  just flipping top for bottom or left for right, you don't have a problem.  Otherwise,\npay attention.  If you're interested in the details of the thrashing problem and how  pamflip\napproaches it, you're invited to read a complete explanation in comments in the source code.\n\n\n"
                    },
                    {
                        "name": "-memsize=_",
                        "content": "mebibytes  is  the  size in mebibytes (aka megabytes) of memory available for pamflip.\nIt is the lesser of the amount of real or virtual memory available.\n\npamflip does nothing special to allocate real memory or control it's allocation --  it\ngets  whatever  it  gets just by referencing virtual memory normally.  The real memory\nfigure in question is the maximum amount that pamflip can be expected to end  up  with\nby  doing that.  This is just about impossible for you to know, of course, but you can\nestimate.  The total real memory in your system should be a major factor in your esti‐\nmate.\n\nIf pamflip cannot fit the entire image in the amount of memory you  specify,  it  does\nthe transformation in chunks, using temporary files for intermediate results.\n\nIn strict horizontal transformations (left for right) or the null transformation, pam‐\nflip  never  keeps  more  than one row in memory, so the memory size is irrelevant and\npamflip doesn't use temporary files.\n\nIn strict vertical transformations (top for  bottom),  even  when  you  allow  pamflip\nenough  memory  to keep the entire image in virtual memory, it accesses it in a single\npass, which does not cause any thrashing; the chunks in  temporary  files  thus  don't\nhelp.\n\nThe real memory is important when you do a column for row type of transformation (e.g.\n-rotate90).   In that case, even if pamflip can fit the entire image in virtual memory\nat once, if it does not also fit in real memory, the program will  thrash  like  crazy\nbecause of the order in which pamflip accesses the pixels, and that means it will take\na ridiculously long time to run.  A proper -memsize drastically reduces the paging.\n\nIf you specify -memsize too large, pamflip may attempt to get more virtual memory than\nthe  system  allows  it  and  fail.  If it can get the virtual memory, but -memsize is\nlarger than the amount of real memory the system allows it and the  transformation  is\nrow  for  column,  it will page thrash and run very slowly.  A value even slightly too\nhigh is the same as infinity.\n\nIf you specify -memsize too small, the program will run slightly more  slowly  because\nof  extra  overhead  in manipulating temporary files.  Also, if your environment isn't\nset up to make temporary files possible, pamflip will fail.\n\nDoing the entire transformation \"in memory\" doesn't speed things up  as  much  as  you\nmight  think,  because even with the temporary files, the data is just as likely to be\nin memory.  Virtual memory gets paged to disk and disk files get cached in memory.  In\nfact, the pixels fit much more compactly into memory when stored in a  temporary  file\nthan  when stored \"in memory\" because pamflip uses a more efficient format.  So you're\nlikely to have less disk I/O when you allow pamflip less memory.\n\nIf you do not specify -memsize, pamflip assumes infinity.\n\nThis option did not exist before Netpbm 10.7 (August 2002).\n\nBefore Netpbm 10.42 (March 2008), this option applied only to  real  memory.   pamflip\nwould  always  keep  the entire image in virtual memory and if it could not get enough\nvirtual memory, it failed.  pamflip accessed the pixels in an order designed  to  keep\nreal memory use within the specified amount.\n\n"
                    },
                    {
                        "name": "-pagesize=_",
                        "content": "bytes is the size in bytes of a paging unit -- the amount of memory that gets paged in\nor out as an indivisible unit -- in your system.  The default is 4KiB.\n\nThis option has no effect.\n\nBefore Netpbm 10.42 (March 2008), pamflip used it to control its use of real memory.\n\nThis option did not exist before Netpbm 10.7 (August 2002).\n\n\n\n"
                    },
                    {
                        "name": "Miscellaneous",
                        "content": ""
                    },
                    {
                        "name": "-verbose",
                        "content": "This option causes pamflip to issue messages to Standard Error about its progress.\n\n\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "pnmrotate(1), pnm(1), pam(1), jpegtran manual\n\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "pamflip  replaced  pnmflip  in Netpbm 10.13 (December 2002).  pamflip is backward compatible,\nbut also works on PAM images.\n\n\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Copyright (C) 1989 by Jef Poskanzer.\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/pamflip.html\n\nnetpbm documentation                       20 January 2008                    Pamflip User Manual(1)",
                "subsections": []
            }
        }
    }
}