ppmtoarbtxt


Updated: 01 September 1995
Index  

NAME

ppmtoarbtxt - generate text file from portable pixmap  

SYNOPSIS

ppmtoarbtxt bodyskl [-hd headskl] [-tl tailskl] [ppmfile]  

DESCRIPTION

Reads a portable pixmap as input. For each pixel in the pixmap the contents of the skeleton file bodyskl is written to stdout after performing some substitutions:
#(ired format blackref whiteref)
Writes red value of the pixel as integer in range blackref to whiteref using format. A red value of 0 is written as blackref, a red value of maxval is written as whiteref. #(ired) is equivalent to #(ired %d 0 255).
#(igreen format blackref whiteref)
Same as #(ired..., but green value.
#(iblue format blackref whiteref)
Same as #(ired..., but blue value.
#(ilum format blackref whiteref)
Same as #(ired..., but luminance value (0.299*red + 0.587*green + 0.114*blue).
#(fred format blackref whiteref)
Writes red value of the pixel as float in range blackref to whiteref using format. A red value of 0 is written as blackref, a red value of maxval is written as whiteref. #(fred) is equivalent to #(fred %f 0.0 1.0).
#(fgreen format blackref whiteref)
Same as #(fred..., but green value.
#(fblue format blackref whiteref)
Same as #(fred..., but blue value.
#(flum format blackref whiteref)
Same as #(fred..., but luminance value (0.299*red + 0.587*green + 0.114*blue).
#(width) , #(height)
Writes width or height of portable pixmap.
#(posx) , #(posy)
Writes x- or y-position of the pixel. The first pixel of the portable pixmap is at posx=0, posy=0. The last pixel is at posx=width-1, posy=height-1.

If the skeleton file ends with a LF-character, this character is discarded.  

OPTIONS

-hd headskl
Writes content of file headskl to stdout before processing the portable pixmap. The same substitutions as for bodyskl are performed.
-tl tailskl
Writes content of file tailskl to stdout after processing the portable pixmap. The same substitutions as for bodyskl are performed.
 

EXAMPLES

Generation of a portable graymap with gray inversion (like ppmtopgm | pnminvert):

Head skeleton:
P2
#(width) #(height)
255
Body skeleton:
#(ilum %d 255 0)

Generation of a povray file where each pixel is represented by a sphere at location (x,y,z) = (posx,height-posy,luminance). The colour of the sphere is the colour of the pixel:

Head skeleton:
#include "colors.inc"
#include "textures.inc"
camera {
   location  <#(width) * 0.6, #(height) * 0.7, 80>
   look_at   <#(width) * 0.5, #(height) * 0.5, 0>
}

light_source { <#(width) * 0.5, #(height) * 0.5, 25> color White
}
Body skeleton:
sphere { <#(posx),#(height)-#(posy),#(ilum %d 0 10)>, 0.5
  texture {
    pigment {
      color rgb <#(fred),#(fgreen),#(fblue)>
    }
    finish {
      phong 1
    }
  }
}
 

SEE ALSO

pnmtoplainpnm ppm

HISTORY

ppmtoarbtxt was added to Netpbm in Release 10.14 (March 2003)  

AUTHOR

Copyright (C) 1995 by Peter Kirchgessner
 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
SEE ALSO
HISTORY
AUTHOR