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