1Ppmshadow User Manual(0)                              Ppmshadow User Manual(0)
2
3
4

NAME

6       ppmshadow - add simulated shadows to a PPM image
7
8

SYNOPSIS

10       ppmshadow [-b blur_size] [-k] [-t] [-x xoffset] [-y yoffset] [ppmfile]
11
12
13

DESCRIPTION

15       This program is part of Netpbm(1).
16
17       ppmshadow  adds  a  simulated shadow to an image, giving the appearance
18       that the contents of the image float above the page, casting a  diffuse
19       shadow  on  the  background.   Shadows  can either be black, as cast by
20       opaque objects, or translucent, where the shadow takes on the color  of
21       the object which casts it.  You can specify the crispness of the shadow
22       and its displacement from the image with command line options.
23
24       ppmshadow sees your image as a foreground on a background.   The  back‐
25       ground  color  is  whatever  color the top left pixel of your image is.
26       The background is all the pixels that are that color and the foreground
27       is everything else.  The shadow that ppmshadow generates is a shadow of
28       the foreground, cast on the background.
29
30       The shadow is the same size as the foreground,  plus  some  fringes  as
31       determined  by  the  -b  option.  It is truncated to fit in your image.
32       The output image is the same dimensions as the input image.
33
34       You can use pamcomp to place  a  foreground  image  over  a  background
35       before  running ppmshadow on it.  You can use ppmmake to make the back‐
36       ground image (just an image of a solid color).
37
38       The output has the same dimensions and maxval as the input.
39
40       The blurring to make the fringes of the shadow will not have  a  desir‐
41       able  effect if the color depth (maxval) of the image is too low -- you
42       need a high maxval to get all the shades needed to create a smooth gra‐
43       dient.   So if your input has low maxval (including most notably if the
44       input is PBM, which means its maxval is 1), run it through pamdepth  to
45       raise its maxval.  255 is usually a good choice.
46
47       Input  is a PPM file named by the ppmfile command line argument; if you
48       don't specify ppmfile, the input is Standard Input.
49
50       The output is a PPM file, written to Standard Output.
51
52
53

OPTIONS

55       -b blur_size
56              Sets the distance of the light source from  the  image.   Larger
57              values  move  the  light  source  closer, casting a more diffuse
58              shadow, while smaller settings  move  the  light  further  away,
59              yielding a sharper shadow.  blur_size is the number of pixels of
60              fringe there is on the shadow, beyond where the shadow would  be
61              if there were no blurring.
62
63              The default is 11 pixels.
64
65              Note  that this option controls only the fringing effect of mov‐
66              ing the light source closer to the object.  It does not make the
67              shadow  grow or shrink as would happpen in the real world if you
68              moved a point light source closer to and further from an object.
69
70
71       -k     Keep the intermediate temporary image  files.   When  debugging,
72              these  intermediate files provide many clues as to the source of
73              an error.  See below ⟨#files⟩  for a list  of  the  contents  of
74              each file.
75
76
77       -t     Consider the non-background material in the image translucent --
78              it casts shadows of its own color rather than  a  black  shadow,
79              which  is  default.   This often results in fuzzy, difficult-to-
80              read images but in some circumstances may look better.
81
82
83       -x xoffset
84              Specifies the displacement of the light source to  the  left  of
85              the  image.   Larger  settings of xoffset displace the shadow to
86              the right, as would be cast by a light further to the left.   If
87              not  specified,  the  horizontal  offset  is  half  of blur_size
88              (above), to the left.
89
90
91       -y yoffset
92               Specifies the displacement of the light source above the top of
93              the image.  Larger settings displace the shadow downward, corre‐
94              sponding to moving the light further above the top of the image.
95              If  you  don't  specify  -y, the vertical offset defaults to the
96              same as the horizontal offset (above), upward.
97
98
99
100
101

LIMITATIONS

103       The source image must contain sufficient space  on  the  edges  in  the
104       direction  in  which  the shadow is cast to contain the shadow -- if it
105       doesn't some of the internal steps may fail.  You  can  usually  expand
106       the  border  of  a too-tightly-cropped image with pnmmargin before pro‐
107       cessing it with ppmshadow.
108
109       Black pixels and pixels with the same color  as  the  image  background
110       don't  cast  a  shadow.   If  this  causes unintentional "holes" in the
111       shadow, fill the offending areas with a color which differs from  black
112       or  the  background  by RGB values of 1, which will be imperceptible to
113       the viewer.  Since the comparison is exact, the modified areas will now
114       cast shadows.
115
116       The  background  color  of  the source image (which is preserved in the
117       output) is deemed to be the color of the pixel at the top left  of  the
118       input  image.  If that pixel isn't part of the background, simply add a
119       one-pixel border at the top of the image, generate  the  shadow  image,
120       then delete the border from it.
121
122       If something goes wrong along the way, the error messages from the var‐
123       ious Netpbm programs ppmshadow calls will, in general,  provide  little
124       or  no  clue  as to where ppmshadow went astray.  In this case, Specify
125       the -k option and examine the intermediate  results  in  the  temporary
126       files  (which this option causes to be preserved).  If you manually run
127       the commands that ppmshadow runs on these files,  you  can  figure  out
128       where  the  problem  is.   In  problem cases where you want to manually
129       tweak the image generation process along the  way,  you  can  keep  the
130       intermediate  files with the -k  option, modify them appropriately with
131       an image editor, then recombine them with the steps used by the code in
132       ppmshadow.
133
134       Shadows  are  by default black, as cast by opaque material in the image
135       occluding white light.  Use the -t option to simulate translucent mate‐
136       rial,  where the shadow takes on the color of the object that casts it.
137       If the contrast between the image and background is  insufficient,  the
138       -t option may yield unattractive results which resemble simple blurring
139       of the original image.
140
141       Because Netpbm used to have a maximum maxval of 255, which  meant  that
142       the  largest  convolution  kernel  pnmconvol  could  use  was 11 by 11,
143       ppmshadow includes a horrid, CPU-time-burning kludge which, if  a  blur
144       of  greater  than 11 is requested, performs an initial convolution with
145       an 11 x 11 kernel, then calls pnmsmooth (which is itself a program that
146       calls  pnmconvol  with  a  3 x 3 kernel) as many times as the requested
147       blur exceeds 11.  It's ugly, but it gets the job  done  on  those  rare
148       occasions where you need a blur greater than 11.
149
150       If  you  wish to generate an image at high resolution, then scale it to
151       publication size with pamscale in order to eliminate  jagged  edges  by
152       resampling, it's best to generate the shadow in the original high reso‐
153       lution image, prior to scaling it down in size.  If you scale first and
154       then  add the shadow, you'll get an unsightly jagged stripe between the
155       edge of material and its shadow, due to resampled  pixels  intermediate
156       between the image and background obscuring the shadow.
157
158

EXIT STATUS

160       ppmshadow  returns status 0 if processing was completed without errors,
161       and a nonzero Unix error code if an error prevented generation of  out‐
162       put.  Some errors may result in the script aborting, usually displaying
163       error messages from various Netpbm components it uses, without  return‐
164       ing  a  nonzero error code.  When this happens, the output file will be
165       empty, so be sure to test this if you need to know if the program  suc‐
166       ceeded.
167
168

SEE ALSO

170       pnm(1), pnmmargin(1), pnmconvol(1), pamscale(1), pnmsmooth(1), ppm(1)
171
172
173

TEMPORARY FILES

175       ppmshadow  creates a number of temporary files as it executes.  It cre‐
176       ates a new directory for them in the  directory  named  by  the  TMPDIR
177       environment variable, defaulting to /tmp if it is not set.
178
179       In  normal  operation,  ppmshadow finds a unique name for the temporary
180       directory and deletes each temporary file as soon as it is done with it
181       and leaves no debris around after it completes.  To preserve the inter‐
182       mediate files for debugging, use the -k command line option.   In  that
183       case,  the  directory name is ppmshadowpid, where pid is the process ID
184       of the ppmshadow process, and the program  fails  if  ppmshadow  cannot
185       create that directory because the name is already in use.
186
187       The temporary files are:
188
189
190
191       infile.ppm
192              A copy of the input.
193
194
195       background.ppm
196              Blank image with background of source image
197
198
199       bgmask.ppm
200              Positive binary mask
201
202
203       convkernel.ppm
204              Convolution kernel for blurring shadow
205
206
207       blurredlackshad.ppm
208              Blurred shadow image before coloring
209
210
211       blurred.ppm
212              Blurred, colored shadow image
213
214
215       shadow.ppm
216              Clipped shadow image, offset as requested
217
218
219       shadback.ppm
220              Generated shadow times positive mask
221
222
223
224

AUTHOR

226       John  Walker  http://www.fourmilab.chhttp://www.fourmilab.ch⟩  August
227       8, 1997
228
229
231       This software is in the public domain.  Permission to use,  copy,  mod‐
232       ify, and distribute this software and its documentation for any purpose
233       and without fee is hereby granted, without any conditions  or  restric‐
234       tions.
235

DOCUMENT SOURCE

237       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
238       source.  The master documentation is at
239
240              http://netpbm.sourceforge.net/doc/ppmshadow.html
241
242netpbm documentation             24 June 2017         Ppmshadow User Manual(0)
Impressum