Mercurial > octave-libtiff
annotate scripts/image/imwrite.m @ 15714:b1cd65881592
Clean up scripts in image directory.
Use Octave coding conventions. Redo docstrings. Add %!tests.
* brighten.m: Put input validation first. Use iscolormap to simplify
input checking.
* cmunique.m: Use faster method of validating input class.
* colormap.m: Tweak docstring. Improve input validation.
* contrast.m: Tweak docstring. Use cmap instead of map as variable
name for clarity.
* gray2ind.m: Wrap long lines. Use faster method of validating input class.
Delete unreachable code for n>65536.
* hsv2rgb.m: Use faster method of validating input class.
* imwrite.m: Tweak FIXME notes.
* ind2gray.m: Use correct caller name for ind2x. Update %!tests
with new 2-input calling convention.
* ind2rgb.m: Tweak docstring. Update %!tests with new 2-input
calling convention.
* iscolormap.m: Tweak docstring. Re-order validation tests.
* ntsc2rgb.m: Use faster method of validating input class. Better input
validation. Add %!tests.
* private/ind2x.m: Use more descriptive variable names.
* rgb2hsv.m: Tweak docstring. Use faster method of validating input class.
* rgb2ind.m: Tweak docstring. Wrap long lines.
* rgb2ntsc.m: Use faster method of validating input class. Improve input
validation. Add %!tests.
* rgbplot.m: Match variable names in docstring to those in function
prototype.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 02 Dec 2012 10:02:57 -0800 |
parents | 4beb3a4bd440 |
children | 59f575e504dc |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11591
diff
changeset
|
1 ## Copyright (C) 2008-2012 John W. Eaton |
7987 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
20 ## @deftypefn {Function File} {} imwrite (@var{img}, @var{filename}) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
21 ## @deftypefnx {Function File} {} imwrite (@var{img}, @var{filename}, @var{fmt}) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
22 ## @deftypefnx {Function File} {} imwrite (@var{img}, @var{filename}, @var{fmt}, @var{p1}, @var{v1}, @dots{}) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
23 ## @deftypefnx {Function File} {} imwrite (@var{img}, @var{map}, @var{filename}, @dots{}) |
7987 | 24 ## Write images in various file formats. |
25 ## | |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
26 ## If @var{fmt} is not supplied, the file extension of @var{filename} is used |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
27 ## to determine the format. |
7987 | 28 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
29 ## The parameter-value pairs (@var{p1}, @var{v1}, @dots{}) are optional. |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
30 ## Currently the following options are supported for @t{JPEG} images: |
8148 | 31 ## |
32 ## @table @samp | |
33 ## @item Quality | |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
34 ## Set the quality of the compression. The value should be an |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
35 ## integer between 0 and 100, with larger values indicating higher visual |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
36 ## quality and lower compression. |
8148 | 37 ## @end table |
38 ## | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
39 ## @strong{Supported Formats} |
10985
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
40 ## @multitable @columnfractions .33 .66 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
41 ## @headitem Extension @tab Format |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
42 ## @item bmp @tab Windows Bitmap |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
43 ## @item gif @tab Graphics Interchange Format |
10985
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
44 ## @item jpg and jpeg @tab Joint Photographic Experts Group |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
45 ## @item pbm @tab Portable Bitmap |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
46 ## @item pcx @tab |
10985
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
47 ## @item pgm @tab Portable Graymap |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
48 ## @item png @tab Portable Network Graphics |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
49 ## @item pnm @tab Portable Anymap |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
50 ## @item ppm @tab Portable Pixmap |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
51 ## @item ras @tab Sun Raster |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
52 ## @item tif and tiff @tab Tagged Image File Format |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
53 ## @item xwd @tab X11 Dump |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
54 ## @end multitable |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
55 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
56 ## @strong{Unsupported Formats} |
10985
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
57 ## @multitable @columnfractions .33 .66 |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
58 ## @headitem Extension @tab Format |
10985
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
59 ## @item hdf @tab Hierarchical Data Format V4 |
11591
1d13679b587e
Use @nospell macro on certain words in docstrings.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
60 ## @item @nospell{jp2} and jpx @tab Joint Photographic Experts Group 2000 |
10985
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
61 ## @end multitable |
165e7e79b82c
Updated for writing image files via imwrite.
John Swensen <jpswensen@gmail.com>
parents:
10891
diff
changeset
|
62 ## |
8148 | 63 ## @seealso{imread, imfinfo} |
7987 | 64 ## @end deftypefn |
65 | |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
66 function imwrite (img, varargin) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
67 |
11035
8a6b7947f618
Added support for checking supported image types at runtime.
John Swensen <jpswensen@gmail.com>
parents:
10985
diff
changeset
|
68 persistent imwrite_possible_formats = { |
11038
35416c9baf76
missing semicolon in last imwrite changeset
John W. Eaton <jwe@octave.org>
parents:
11035
diff
changeset
|
69 "bmp"; "gif"; "jp2"; "jpg"; "jpx"; "jpeg"; "hdf"; "pbm"; "pcx"; |
11035
8a6b7947f618
Added support for checking supported image types at runtime.
John Swensen <jpswensen@gmail.com>
parents:
10985
diff
changeset
|
70 "pgm"; "png"; "pnm"; "ppm"; "ras"; "tif"; "tiff"; "xwd" }; |
7987 | 71 |
11035
8a6b7947f618
Added support for checking supported image types at runtime.
John Swensen <jpswensen@gmail.com>
parents:
10985
diff
changeset
|
72 persistent accepted_formats = __magick_format_list__ (imwrite_possible_formats); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
73 |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
74 if (nargin < 2 || ! (isnumeric (img) || islogical (img))) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
75 print_usage (); |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
76 endif |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
77 |
7987 | 78 map = []; |
79 fmt = ""; | |
80 | |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
81 offset = 1; |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
82 if (isnumeric (varargin{1})) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
83 map = varargin{1}; |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
84 if (isempty (map)) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
85 error ("imwrite: colormap must not be empty"); |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
86 endif |
7987 | 87 offset = 2; |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
88 endif |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
89 if (offset <= length (varargin) && ischar (varargin{offset})) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
90 filename = varargin{offset}; |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
91 offset++; |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
92 if (rem (length (varargin) - offset, 2) == 0 && ischar (varargin{offset})) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
93 fmt = varargin{offset}; |
7987 | 94 offset++; |
95 endif | |
96 else | |
97 print_usage (); | |
98 endif | |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
99 if (offset < length (varargin)) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
100 has_param_list = 1; |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
101 for ii = offset:2:(length (varargin) - 1) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
102 options.(varargin{ii}) = varargin{ii + 1}; |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
103 endfor |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
104 else |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
105 has_param_list = 0; |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
106 endif |
7987 | 107 |
108 filename = tilde_expand (filename); | |
109 | |
110 if (isempty (fmt)) | |
111 [d, n, fmt] = fileparts (filename); | |
112 if (! isempty (fmt)) | |
113 fmt = fmt(2:end); | |
114 endif | |
115 endif | |
116 | |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
117 if (isempty (img)) |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
118 error ("imwrite: invalid empty image"); |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
119 endif |
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
120 |
7987 | 121 if (issparse (img) || issparse (map)) |
122 error ("imwrite: sparse images not supported"); | |
123 endif | |
124 | |
125 if (! strcmp (fmt, accepted_formats)) | |
126 error ("imwrite: %s: unsupported or invalid image format", fmt); | |
127 endif | |
128 | |
129 img_class = class (img); | |
130 map_class = class (map); | |
8054 | 131 nd = ndims (img); |
7987 | 132 |
133 if (isempty (map)) | |
134 if (any (strcmp (img_class, {"logical", "uint8", "uint16", "double"}))) | |
135 if ((nd == 2 || nd == 3) && strcmp (img_class, "double")) | |
8054 | 136 img = uint8 (img * 255); |
7987 | 137 endif |
15714
b1cd65881592
Clean up scripts in image directory.
Rik <rik@octave.org>
parents:
15515
diff
changeset
|
138 ## FIXME: should we handle color images with alpha channel here? |
8054 | 139 if (nd == 3 && size (img, 3) < 3) |
140 error ("imwrite: invalid dimensions for truecolor image"); | |
7987 | 141 endif |
142 if (nd > 5) | |
8054 | 143 error ("imwrite: invalid %d-dimensional image data", nd); |
7987 | 144 endif |
145 else | |
146 error ("imwrite: %s: invalid class for truecolor image", img_class); | |
147 endif | |
8054 | 148 if (has_param_list) |
149 __magick_write__ (filename, fmt, img, options); | |
150 else | |
151 __magick_write__ (filename, fmt, img); | |
152 endif | |
7987 | 153 else |
154 if (any (strcmp (img_class, {"uint8", "uint16", "double"}))) | |
155 if (strcmp (img_class, "double")) | |
8054 | 156 img = uint8 (img - 1); |
7987 | 157 endif |
8054 | 158 if (nd != 2 && nd != 4) |
159 error ("imwrite: invalid size for indexed image"); | |
7987 | 160 endif |
161 else | |
162 error ("imwrite: %s: invalid class for indexed image data", img_class); | |
163 endif | |
15515
4beb3a4bd440
rgbplot.m, cmpermute.m, cmunique.m, ind2rgb.m, imwrite.m: use core iscolormap function
Carnë Draug <carandraug+dev@gmail.com>
parents:
14872
diff
changeset
|
164 if (! iscolormap (map)) |
4beb3a4bd440
rgbplot.m, cmpermute.m, cmunique.m, ind2rgb.m, imwrite.m: use core iscolormap function
Carnë Draug <carandraug+dev@gmail.com>
parents:
14872
diff
changeset
|
165 error ("imwrite: invalid indexed image colormap"); |
7987 | 166 endif |
9275
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
167 |
15714
b1cd65881592
Clean up scripts in image directory.
Rik <rik@octave.org>
parents:
15515
diff
changeset
|
168 ## FIXME: we should really be writing indexed images here but |
b1cd65881592
Clean up scripts in image directory.
Rik <rik@octave.org>
parents:
15515
diff
changeset
|
169 ## __magick_write__ needs to be fixed to handle them. |
9275
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
170 |
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
171 [r, g, b] = ind2rgb (img, map); |
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
172 tmp = uint8 (cat (3, r, g, b) * 255); |
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
173 |
8054 | 174 if (has_param_list) |
9275
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
175 __magick_write__ (filename, fmt, tmp, options); |
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
176 ## __magick_write__ (filename, fmt, img, map, options); |
8054 | 177 else |
9275
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
178 __magick_write__ (filename, fmt, tmp); |
86f475d5e7d1
imwrite.m: convert indexed images to RGB before calling __magick_write__
John W. Eaton <jwe@octave.org>
parents:
9051
diff
changeset
|
179 ## __magick_write__ (filename, fmt, img, map); |
8054 | 180 endif |
7987 | 181 endif |
182 | |
183 endfunction | |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
184 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
185 |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
186 %% Test input validation |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
187 %!error imwrite () # Wrong # of args |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
188 %!error imwrite (1) # Wrong # of args |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
189 %!error imwrite ({"cell"}, "filename.jpg") # Wrong class for img |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
190 %!error imwrite (1, [], "filename.jpg") # Empty image map |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
191 %!error imwrite (1, 2, 3) # No filename specified |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
192 %!error imwrite (1, "filename") # No fmt specified |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
193 %!error imwrite (1, "filename", "junk") # Invalid fmt specified |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
194 %!error imwrite ([], "filename.jpg") # Empty img matrix |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
195 %!error imwrite (spones (2), "filename.jpg") # Invalid sparse img |
10891
ff94219746bd
imwrite.m: Allow writing of 1-bit (B&W) images.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
196 |