Plan 9 from Bell Labs’s /usr/web/sources/contrib/pac/sys/doc/netpbm/ms/ppmtoarbtxt.ms

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TL
Ppmtoarbtxt User Manual
.SH 1
ppmtoarbtxt
.LP
.br
Updated: 27 April 2003
.br
Table Of Contents
.SH 2
NAME
.LP
ppmtoarbtxt - generate image in arbitrary text format from PPM image
.SH 2
SYNOPSIS
.LP
\fBppmtoarbtxt\fR
\fIbodyskl\fR
[\fB-hd\fR \fIheadskl\fR]
[\fB-tl\fR \fItailskl\fR]
[\fIppmfile\fR]
.SH 2
DESCRIPTION
.LP
.LP
This program is part of Netpbm.
\fBppmtoarbtxt\fR generates simple text-based graphics formats based on
format descriptions given as input.  A text-based graphics format is one in
which an image is represented by text (like PNM plain format, but unlike
PNM raw format).
\fBppmtoarbtxt\fRreads a PPM image as input.  For each pixel in the
image, \fBppmtoarbtxt\fR writes the contents of the skeleton file
\fIbodyskl\fR, with certain substitutions based on the value of the
pixel, to stdout.  The substitutions are as follows:
.RS
.IP "\fB#(ired\fR\fI format blackref whiteref\fR\fB)\fR"
generates an integer in the range \fIblackref\fR to
\fIwhiteref\fR using \fIformat\fR representing the red intensity of
the pixel.  A red intensity of 0 becomes \fIblackref\fR; a red
intensity of maxval becomes \fIwhiteref\fR.
.LP
\fB#(ired)\fR is equivalent to \fB#(ired %d 0 255)\fR.
.IP "\fB#(igreen\fR\fI format blackref whiteref\fR\fB)\fR"
Same as \fB#(ired...\fR, but for green.
.IP "\fB#(iblue\fR\fI format blackref whiteref\fR\fB)\fR"
Same as \fB#(ired...\fR, but for blue.
.IP "\fB#(ilum\fR\fI format blackref whiteref\fR\fB)\fR"
Same as \fB#(ired...\fR, but representing the luminance value
(0.299*red + 0.587*green + 0.114*blue) of the pixel.
.IP "\fB#(fred\fR\fI format blackref whiteref\fR\fB)\fR"
Same as \fB#(ired...\fR, but generates a floating point number instead
of an integer.
.LP
\fB#(fred)\fR is equivalent to \fB#(fred %f 0.0 1.0)\fR.
.IP "\fB#(fgreen\fR\fI format blackref whiteref\fR\fB)\fR"
Same as \fB#(fred...\fR, but for green.
.IP "\fB#(fblue\fR\fI format blackref whiteref\fR\fB)\fR"
Same as \fB#(fred...\fR, but for blue.
.IP "\fB#(flum\fR\fI format blackref whiteref\fR\fB)\fR"
Same as \fB#(fred...\fR, but representing the luminance value
(0.299*red + 0.587*green + 0.114*blue) of the pixel.
.IP "\fB#(width)\fR"
Generates the width in pixels of the image.
.IP "\fB#(height)\fR"
Generates the height in pixels of the image.
.IP "\fB#(posx)\fR "
Generates the horizontal position of the pixel, in pixels from the left
edge of the image.
.IP "\fB#(posy)\fR "
Generates the vertical position of the pixel, in pixels from the top
edge of the image.
.RE
.LP
If the skeleton file ends with a LF-character, \fBppmtoarbtxt\fR
ignores it -- it does not include it in the output.
.SH 2
OPTIONS
.LP
.RS
.IP "\fB-hd\fR \fIheadskl\fR"
This option causes \fBppmtoarbtxt\fR to place the contents of
the file named \fIheadskl\fR at the beginning of the output, before
the first pixel.  It does the same substitutions as for
\fIbodyskl\fR, except substitutions based on a pixel value are
undefined.
.IP "\fB-tl\fR \fItailskl\fR"
This option causes \fBppmtoarbtxt\fR to place the contents of
the file named \fItailskl\fR at the end of the output, after the
last pixel.  It is analogous to \fB-hd\fR.
.RE
.SH 2
EXAMPLES
.LP
.SH 3
gray inversion
.LP
.LP
Here we generate a PGM plain-format image with gray inversion
(like \fBppmtopgm | pnminvert\fR).
.LP
Contents of our head skeleton file:
.DS L
P2
#(width) #(height)
255
.DE
.LP
Contents of our body skeleton file:
.DS L
#(ilum %d 255 0)
.DE
.SH 3
povray file
.LP
.LP
Here we generate a povray file where each pixel is represented by a
sphere at location (x,y,z) = (posx,height-posy,luminance).  The color
of the sphere is the color of the pixel.
.LP
Contents of our head skeleton:
.DS L
#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
}
.DE
.LP
Contents of our body skeleton:
.DS L
sphere { <#(posx),#(height)-#(posy),#(ilum %d 0 10)>, 0.5
  texture {
    pigment {
      color rgb <#(fred),#(fgreen),#(fblue)>
    }
    finish {
      phong 1
    }
  }
}
.DE
.SH 2
SEE ALSO
.LP
pnmtoplainpnm
ppm
.SH 2
HISTORY
.LP
.LP
\fBppmtoarbtxt\fR was added to Netpbm in Release 10.14 (March 2003).
It existed under the name \fBppmtotxt\fR since 1995.
.SH 2
AUTHOR
.LP
Copyright (C) 1995 by Peter Kirchgessner
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
NAME
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
EXAMPLES
.IP \(bu
SEE ALSO
.IP \(bu
HISTORY
.IP \(bu
AUTHOR
.LP

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.