about summary refs log tree commit diff
path: root/pamtooctaveimg.html
blob: 9cadc135c9e25a956aefa7345a29289dd9dea0f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Pamtooctaveimg User Manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>

<h1>pamtooctaveimg</h1>

<p>Updated: 27 June 2007<br />
<a href="#index">Table Of Contents</a></p>

<h2>NAME</h2>

<p>pamtooctaveimg - convert a Netpbm image to a GNU Octave image</p>

<h2 id="synopsis">SYNOPSIS</h2>

<p><b>pamtooctaveimg</b>
[<i>netpbmfile</i>]

<h2 id="description">DESCRIPTION</h2>

<p>This program is part of <a href="index.html">Netpbm</a>.</p>

<p><b>pamtooctaveimg</b> reads a Netpbm image as input and produces a <a
href="http://www.octave.org/">GNU Octave</a> image file as output.

<p>An Octave image file (called "Octave's image format" in
Octave documentation) is a particular kind of Octave data file.  It
describes two matrices:

<ol>
<li>the image itself as a list of indexes into a colormap, and</li>
<li>the corresponding colormap as a list of {red, green, blue} triplets.</li>
</ol>

<p>An Octave data file is an ASCII text file that you use to import data
to Octave.

<p>See the <a
href="http://www.gnu.org/software/octave/doc/interpreter/Image-Processing.html#Image-Processing">
Image Processing chapter</a> of the GNU Octave manual for details.

<p><b>pamtooctaveimg</b> writes the output Octave image to Standard Output.

<h2 id="arguments">Arguments</h2>

<p><i>netpbmfile</i> is the name of the file containing the input PNM
or PAM image, or <b>-</b> to indicate Standard Input.  If you don't
specify <i>netpbmfile</i>, the input is from Standard Input.
<b>pamtooctaveimg</b> converts only the first image in the input stream.


<h2 id="examples">Examples</h2>

<pre>
<kbd>
   % pamtooctaveimg myimage.ppm > myimage.img
   % octave
   > [img,map] = loadimage("myimage.img");

   # (At this point, img is an X by Y matrix and map is a 3 by M matrix.)

   > imshow(img,map);   # Displays img with colormap map
   > [r,g,b] = ind2rgb(img,map);

   # (r, g, and b are now each X by Y matrices of color levels [0 to 1].)

   > [newimg,newmap] = rgb2ind(r,b,g);   # Swap the blue and green channels.
   > saveimage("newimage.ppm", newimg, "ppm", newmap);  # Save as a PPM file.
</kbd>
</pre>


<h2 id="notes">NOTES</h2>

<p>There is no <b>octavetopam</b> program.  However, GNU Octave's
<b>saveimage</b> command can save images in PPM format.</p>


<h2 id="history">HISTORY</h2>

<p><b>pamtooctaveimg</b> was new in Netpbm 10.39 (June 2007).


<h2 id="seealso">SEE ALSO</h2>

<a
href="http://www.gnu.org/software/octave/doc/interpreter/index.html"><b>octave</b></a>,
<a href="pam.html"><b>pam</b></a>.

<h2><a id="author">AUTHOR</a></h2> 

<p>Copyright (C) 2007 Scott Pakin,
<a href="mailto:scott+pbm@pakin.org">scott+pbm@pakin.org</a>.</p>

<hr />

<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#arguments">ARGUMENTS</a></li>
<li><a href="#examples">EXAMPLES</a></li>
<li><a href="#notes">NOTES</a></li>
<li><a href="#history">HISTORY</a></li>
<li><a href="#seealso">SEE ALSO</a></li>
<li><a href="#author">AUTHOR</a></li>
</ul>
</body>
</html>