{
    "content": [
        {
            "type": "text",
            "text": "# ppmshadow (man)\n\n## NAME\n\nppmshadow - add simulated shadows to a portable pixmap image\n\n## SYNOPSIS\n\nppmshadow [-b blursize] [-k] [-t] [-x xoffset] [-y yoffset] [-u] [pnmfile]\n\n## DESCRIPTION\n\nppmshadow adds a simulated shadow to an image, giving the appearance that the contents of the\nimage float above the page, casting a diffuse shadow on the background.  Shadows  can  either\nbe  black, as cast by opaque objects, or translucent, where the shadow takes on the colour of\nthe object which casts it.  You can specify the extent of the  shadow  and  its  displacement\nfrom the image with command line options.\n\n## TLDR\n\n> Add simulated shadows to a PPM image.\n\n- Add simulated shadows to a PPM image:\n  `ppmshadow {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}`\n- [b]lur the image by the specified number of pixels:\n  `ppmshadow -b {{n}} {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}`\n- Specify the displacement of the simulated light source to the left and the top of the image:\n  `ppmshadow -x {{left_offset}} -y {{top_offset}} {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (6 subsections)\n- **FILES**\n- **LIMITATIONS**\n- **EXIT STATUS**\n- **SEE ALSO**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ppmshadow",
        "section": "",
        "mode": "man",
        "summary": "ppmshadow - add simulated shadows to a portable pixmap image",
        "synopsis": "ppmshadow [-b blursize] [-k] [-t] [-x xoffset] [-y yoffset] [-u] [pnmfile]",
        "tldr_summary": "Add simulated shadows to a PPM image.",
        "tldr_examples": [
            {
                "description": "Add simulated shadows to a PPM image",
                "command": "ppmshadow {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}"
            },
            {
                "description": "[b]lur the image by the specified number of pixels",
                "command": "ppmshadow -b {{n}} {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}"
            },
            {
                "description": "Specify the displacement of the simulated light source to the left and the top of the image",
                "command": "ppmshadow -x {{left_offset}} -y {{top_offset}} {{path/to/input_file.ppm}} > {{path/to/output_file.ppm}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-b",
                "long": null,
                "arg": null,
                "description": "Sets the distance of the light source from the image. Larger values move the light source closer, casting a more diffuse shadow, while smaller settings move the light further away, yielding a sharper shadow. blursize defaults to 11 pixels."
            },
            {
                "flag": "-k",
                "long": null,
                "arg": null,
                "description": "provide many clues as to the source of an error. See FILES below for a list of the contents of each file."
            },
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": "its own colour rather than a black shadow, which is default. This often results in fuzzy, difficult-to-read images but in some circumstances may look better."
            },
            {
                "flag": "-u",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-x",
                "long": null,
                "arg": null,
                "description": "Specifies the displacement of the light source to the left of the image. Larger set‐ tings of xoffset displace the shadow to the right, as would be cast by a light further to the left. If not specified, the horizontal offset is half of blursize (above), to the left."
            },
            {
                "flag": "-y",
                "long": null,
                "arg": null,
                "description": "Specifies the displacement of the light source above the top of the image. Larger settings displace the shadow downward, corresponding to moving the light further above the top of the image. If you don't specify -y, the vertical offset defaults to the same as the horizontal offset (above), upward."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "pnm",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/pnm/5/json"
            },
            {
                "name": "pnmmargin",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmmargin/1/json"
            },
            {
                "name": "pnmconvol",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmconvol/1/json"
            },
            {
                "name": "pnmscale",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmscale/1/json"
            },
            {
                "name": "pnmsmooth",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmsmooth/1/json"
            },
            {
                "name": "ppm",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/ppm/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-b",
                        "lines": 5,
                        "flag": "-b"
                    },
                    {
                        "name": "-k",
                        "lines": 4,
                        "flag": "-k"
                    },
                    {
                        "name": "-t",
                        "lines": 4,
                        "flag": "-t"
                    },
                    {
                        "name": "-u",
                        "lines": 1,
                        "flag": "-u"
                    },
                    {
                        "name": "-x",
                        "lines": 6,
                        "flag": "-x"
                    },
                    {
                        "name": "-y",
                        "lines": 6,
                        "flag": "-y"
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 38,
                "subsections": []
            },
            {
                "name": "LIMITATIONS",
                "lines": 46,
                "subsections": []
            },
            {
                "name": "EXIT STATUS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "ppmshadow - add simulated shadows to a portable pixmap image\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "ppmshadow [-b blursize] [-k] [-t] [-x xoffset] [-y yoffset] [-u] [pnmfile]\n\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "ppmshadow adds a simulated shadow to an image, giving the appearance that the contents of the\nimage float above the page, casting a diffuse shadow on the background.  Shadows  can  either\nbe  black, as cast by opaque objects, or translucent, where the shadow takes on the colour of\nthe object which casts it.  You can specify the extent of the  shadow  and  its  displacement\nfrom the image with command line options.\n\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-b",
                        "content": "Sets  the  distance  of the light source from the image.  Larger values move the light\nsource closer, casting a more diffuse shadow, while smaller settings  move  the  light\nfurther away, yielding a sharper shadow.  blursize defaults to 11 pixels.\n\n",
                        "flag": "-b"
                    },
                    {
                        "name": "-k",
                        "content": "provide many clues as to the source of an error.  See FILES below for a  list  of  the\ncontents of each file.\n\n",
                        "flag": "-k"
                    },
                    {
                        "name": "-t",
                        "content": "its own colour rather than a black shadow, which is default.  This  often  results  in\nfuzzy, difficult-to-read images but in some circumstances may look better.\n\n",
                        "flag": "-t"
                    },
                    {
                        "name": "-u",
                        "content": "",
                        "flag": "-u"
                    },
                    {
                        "name": "-x",
                        "content": "Specifies  the displacement of the light source to the left of the image.  Larger set‐\ntings of xoffset displace the shadow to the right, as would be cast by a light further\nto the left.  If not specified, the horizontal offset is half of blursize (above), to\nthe left.\n\n",
                        "flag": "-x"
                    },
                    {
                        "name": "-y",
                        "content": "Specifies the displacement of the light source above the top  of  the  image.   Larger\nsettings displace the shadow downward, corresponding to moving the light further above\nthe top of the image.  If you don't specify -y, the vertical offset  defaults  to  the\nsame as the horizontal offset (above), upward.\n\n",
                        "flag": "-y"
                    }
                ]
            },
            "FILES": {
                "content": "Input  is an anymap named by the pnmfile command line argument; if you don't specify pnmfile,\nthe input is the Standard Input file.\n\nOutput is a always a PPM file, written to Standard Output.\n\npnmfile creates a number of temporary files as it executes.  It creates them in the /tmp  di‐\nrectory, with names of the form:\n\nPPMshadowpid-N.ppm\n\nwhere  pid  is  the process number of the ppmshadow process and N is a number identifying the\nfile as described below.  In normal operation, ppmshadow deletes temporary files as  soon  as\nit  is done with them and leaves no debris around after it completes.  To preserve the inter‐\nmediate files for debugging, use the -k command line option.\n\nN in the filename means:\n\n1      Positive binary mask\n\n2      Convolution kernel for blurring shadow\n\n3      Blurred shadow image\n\n4      Clipped shadow image, offset as requested\n\n5      Blank image with background of source image\n\n6      Offset shadow\n\n7      Inverse mask file\n\n8      Original image times inverse mask\n\n9      Generated shadow times positive mask\n\n10     Shadow times background colour\n\n",
                "subsections": []
            },
            "LIMITATIONS": {
                "content": "The source image must contain sufficient space on the edges in the  direction  in  which  the\nshadow  is  cast  to contain the shadow -- if it doesn't some of the internal steps may fail.\nYou can usually expand the border of a too-tightly-cropped image with pnmmargin  before  pro‐\ncessing it with ppmshadow.\n\nBlack  pixels and pixels with the same color as the image background don't cast a shadow.  If\nthis causes unintentional \"holes\" in the shadow, fill the offending areas with a color  which\ndiffers  from  black or the background by RGB values of 1, which will be imperceptible to the\nviewer.  Since the comparison is exact, the modified areas will now cast shadows.\n\nThe background color of the source image (which is preserved in the output) is deemed  to  be\nthe  color  of the pixel at the top left of the input image.  If that pixel isn't part of the\nbackground, simply add a one-pixel border at the top of the image, generate the shadow image,\nthen delete the border from it.\n\nIf  something  goes  wrong along the way, the error messages from the various Netpbm programs\nppmshadow calls will, in general, provide little or  no  clue  as  to  where  ppmshadow  went\nastray.  In this case, Specify the -k option and examine the intermediate results in the tem‐\nporary files (which this option causes to be preserved).  If you manually  run  the  commands\nthat  ppmshadow  runs  on  these  files, you can figure out where the problem is.  In problem\ncases where you want to manually tweak the image generation process along the  way,  you  can\nkeep  the intermediate files with the -k option, modify them appropriately with an image edi‐\ntor, then recombine them with the steps used by the code in ppmshadow.  See the ppmshadow.doc\ndocument for additional details and examples of the intermediate files.\n\nShadows  are by default black, as cast by opaque material in the image occluding white light.\nUse the -t option to simulate translucent material, where the shadow takes on the  colour  of\nthe  object that casts it.  If the contrast between the image and background is insufficient,\nthe -t option may yield unattractive results which resemble simple blurring of  the  original\nimage.\n\nBecause Netpbm used to have a maximum maxval of 255, which meant that the largest convolution\nkernel pnmconvol could use was 11 by 11, ppmshadow includes a horrid, CPU-time-burning kludge\nwhich,  if  a  blur  of greater than 11 is requested, performs an initial convolution with an\n11×11 kernel, then calls pnmsmooth (which is actually a script that calls  pnmconvol  with  a\n3×3  kernel)  as many times as the requested blur exceeds 11.  It's ugly, but it gets the job\ndone on those rare occasions where you need a blur greater than 11.\n\nIf you wish to generate an image at high resolution, then scale it to publication  size  with\npnmscale  in  order to eliminate jagged edges by resampling, it's best to generate the shadow\nin the original high resolution image, prior to scaling it down in size.  If you scale  first\nand  then  add the shadow, you'll get an unsightly jagged stripe between the edge of material\nand its shadow, due to resampled pixels intermediate between the image and background obscur‐\ning the shadow.\n\n",
                "subsections": []
            },
            "EXIT STATUS": {
                "content": "ppmshadow returns status 0 if processing was completed without errors, and a nonzero Unix er‐\nror code if an error prevented generation of output.  Some errors may result  in  the  script\naborting,  usually  displaying error messages from various Netpbm components it uses, without\nreturning a nonzero error code.  When this happens, the output file will be empty, so be sure\nto test this if you need to know if the program succeeded.\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "pnm(5), pnmmargin(1), pnmconvol(1), pnmscale(1), pnmsmooth(1), ppm(5)\n\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "John Walker <http://www.fourmilab.ch> August 8, 1997\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "This  software is in the public domain.  Permission to use, copy, modify, and distribute this\nsoftware and its documentation for any purpose and without fee is hereby granted, without any\nconditions or restrictions.\n\n\n\n12 March 2000                               ppmshadow(1)",
                "subsections": []
            }
        }
    }
}