File: imwrite.mdc

package info (click to toggle)
freemat 4.2%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 141,800 kB
  • ctags: 14,082
  • sloc: ansic: 126,788; cpp: 62,046; python: 2,080; perl: 1,255; sh: 1,146; yacc: 1,019; lex: 239; makefile: 100
file content (49 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download | duplicates (2)
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

 Usage

Write the image data from the matrix into a given file. Note
that FreeMat's support for imwrite is not complete. You can
write images in the jpg,png,xpm,ppm and some other formats.
The syntax for its use is

    imwrite(A, filename)
    imwrite(A, map, filename)
    imwrite(A, map, filename, 'Alpha', alpha)

  or Octave-style syntax:
    imwrite(filename, A)
    imwrite(filename, A, map)
    imwrite(filename, A, map, alpha)

where filename is the name of the file to write to. The
input array A contains the image data (2D for gray or
indexed, and 3D for color). If A is an integer array (int8,
uint8, int16, uint16, int32, uint32), the values of its
elements should be within 0-255. If A is a floating-point
array (float or double), the value of its elements should be
in the range [0,1]. map contains the colormap information
(for indexed images), and alpha the alphamap (transparency).


 Example

Here is a simple example of imread/imwrite. First, we
generate a grayscale image and save it to an image file.

  --> a =  uint8(255*rand(64));
  --> figure(1), image(a), colormap(gray)
  --> title('image to save')
  --> imwrite(a, 'test.bmp')

Then, we read image file and show it:

  --> b = imread('test.bmp');
  --> figure(2), image(b), colormap(gray)
  --> title('loaded image')


* FreeMat_Documentation
* Input/Ouput_Functions
* Generated on Thu Jul 25 2013 17:17:38 for FreeMat by
  doxygen_ 1.8.1.1