1Pamtooctaveimg User Manual(0) Pamtooctaveimg User Manual(0)
2
3
4
5<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
6"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html
7xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
8
9<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
12 pamtooctaveimg - convert a Netpbm image to a GNU Octave image
13
14
16 pamtooctaveimg [netpbmfile]
17
18
20 This program is part of Netpbm(1).
21
22 pamtooctaveimg reads a Netpbm image as input and produces a GNU Octave
23 ⟨http://www.octave.org/⟩ image file as output.
24
25 An Octave image file (called 'Octave's image format' in Octave documen‐
26 tation) is a particular kind of Octave data file. It describes two
27 matrices:
28
29
30
31 · the image itself as a list of indexes into a colormap, and
32
33 · the corresponding colormap as a list of {red, green, blue}
34 triplets.
35
36
37 An Octave data file is an ASCII text file that you use to import data
38 to Octave.
39
40 See the
41 Image Processing chapter
42 ⟨http://www.gnu.org/software/octave/doc/interpreter/Image-
43 Processing.html#Image-Processing⟩ of the GNU Octave manual for
44 details.
45
46 pamtooctaveimg writes the output Octave image to Standard Output.
47
48
50 netpbmfile is the name of the file containing the input PNM or PAM
51 image, or - to indicate Standard Input. If you don't specify netpbm‐
52 file, the input is from Standard Input. pamtooctaveimg converts only
53 the first image in the input stream.
54
55
56
58 % pamtooctaveimg myimage.ppm > myimage.img
59 % octave
60 > [img,map] = loadimage("myimage.img");
61
62 # (At this point, img is an X by Y matrix and map is a 3 by M matrix.)
63
64 > imshow(img,map); # Displays img with colormap map
65 > [r,g,b] = ind2rgb(img,map);
66
67 # (r, g, and b are now each X by Y matrices of color levels [0 to 1].)
68
69 > [newimg,newmap] = rgb2ind(r,b,g); # Swap the blue and green channels.
70 > saveimage("newimage.ppm", newimg, "ppm", newmap); # Save as a PPM file.
71
72
73
75 There is no octavetopam program. However, GNU Octave's saveimage com‐
76 mand can save images in PPM format.
77
78
79
81 pamtooctaveimg was new in Netpbm 10.39 (June 2007).
82
83
84
86 octave(1), pam(1).
87
88
90 Copyright (C) 2007 Scott Pakin, scott+pbm@pakin.org.
91
92
93
94netpbm documentation 27 June 2007<br /> Pamtooctaveimg User Manual(0)