Mercurial > octave
comparison scripts/image/imwrite.m @ 21580:ecce63c99c3f
maint: Add semicolons to terminate code in %! blocks.
* splineimages.m, Cell.cc, bsxfun.cc, cellfun.cc, conv2.cc, data.cc,
debug.cc, file-io.cc, gcd.cc, getrusage.cc, graphics.cc, kron.cc, mappers.cc,
oct-map.cc, ordschur.cc, psi.cc, rand.cc, variables.cc, __osmesa_print__.cc,
amd.cc, audiodevinfo.cc, dmperm.cc, qr.cc, ov-bool-mat.cc, ov-class.cc,
ov-fcn-handle.cc, ov-java.cc, oct-parse.in.yy, bicubic.m, delaunay3.m,
accumarray.m, flip.m, fliplr.m, flipud.m, gradient.m, inputParser.m, interp1.m,
narginchk.m, rot90.m, validateattributes.m, delaunay.m, delaunayn.m,
griddata3.m, inpolygon.m, waitbar.m, gray2ind.m, hsv2rgb.m, im2double.m,
image.m, imformats.m, imread.m, imshow.m, imwrite.m, ntsc2rgb.m, rgb2hsv.m,
rgb2ntsc.m, isbanded.m, onenormest.m, edit.m, fullfile.m, license.m, ode23.m,
ode45.m, glpk.m, annotation.m, legend.m, orient.m, text.m, area.m, barh.m,
contour.m, line.m, plot.m, plot3.m, plotyy.m, quiver.m, stem.m, clf.m,
copyobj.m, findobj.m, subplot.m, ppval.m, splinefit.m, ismember.m, freqz.m,
unwrap.m, eigs.m, ichol.m, pcg.m, spdiags.m, svds.m, magic.m, lscov.m,
median.m, ols.m, dec2base.m, strsplit.m, strtok.m, test.m, bug-31371.tst,
bug-36025.tst, bug-44940.tst, build-sparse-tests.sh, class-concat.tst,
classdef.tst, classes.tst, colormaps.tst, command.tst, ctor-vs-method.tst,
error.tst, fcn-handle-derived-resolution.tst, for.tst, index.tst, io.tst,
jit.tst, null-assign.tst, parser.tst, struct.tst, system.tst:
Add semicolons to terminate code in %! blocks.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 01 Apr 2016 16:03:29 -0700 |
parents | 3d60ed163b70 |
children | b571fc85953f |
comparison
equal
deleted
inserted
replaced
21579:0d1bd2ede0c1 | 21580:ecce63c99c3f |
---|---|
142 | 142 |
143 ## typical usage with grayscale uint8 images | 143 ## typical usage with grayscale uint8 images |
144 %!testif HAVE_MAGICK | 144 %!testif HAVE_MAGICK |
145 %! gray = randi (255, 10, 10, 1, "uint8"); | 145 %! gray = randi (255, 10, 10, 1, "uint8"); |
146 %! r = write_and_read (".tif", gray); | 146 %! r = write_and_read (".tif", gray); |
147 %! assert (r, gray) | 147 %! assert (r, gray); |
148 | 148 |
149 ## grayscale uint8 images with alpha channel | 149 ## grayscale uint8 images with alpha channel |
150 %!testif HAVE_MAGICK | 150 %!testif HAVE_MAGICK |
151 %! gray = randi (255, 10, 10, 1, "uint8"); | 151 %! gray = randi (255, 10, 10, 1, "uint8"); |
152 %! alpha = randi (255, 10, 10, 1, "uint8"); | 152 %! alpha = randi (255, 10, 10, 1, "uint8"); |
153 %! [r, ~, a] = write_and_read (".tif", gray, "Alpha", alpha); | 153 %! [r, ~, a] = write_and_read (".tif", gray, "Alpha", alpha); |
154 %! assert (r, gray) | 154 %! assert (r, gray); |
155 %! assert (a, alpha) | 155 %! assert (a, alpha); |
156 | 156 |
157 ## multipage grayscale uint8 images | 157 ## multipage grayscale uint8 images |
158 %!testif HAVE_MAGICK | 158 %!testif HAVE_MAGICK |
159 %! gray = randi (255, 10, 10, 1, 5, "uint8"); | 159 %! gray = randi (255, 10, 10, 1, 5, "uint8"); |
160 %! r = write_and_read (".tif", gray); | 160 %! r = write_and_read (".tif", gray); |
161 %! assert (r, gray) | 161 %! assert (r, gray); |
162 | 162 |
163 ## multipage RGB uint8 images with alpha channel | 163 ## multipage RGB uint8 images with alpha channel |
164 %!testif HAVE_MAGICK | 164 %!testif HAVE_MAGICK |
165 %! gray = randi (255, 10, 10, 3, 5, "uint8"); | 165 %! gray = randi (255, 10, 10, 3, 5, "uint8"); |
166 %! alpha = randi (255, 10, 10, 1, 5, "uint8"); | 166 %! alpha = randi (255, 10, 10, 1, 5, "uint8"); |
167 %! [r, ~, a] = write_and_read (".tif", gray, "Alpha", alpha); | 167 %! [r, ~, a] = write_and_read (".tif", gray, "Alpha", alpha); |
168 %! assert (r, gray) | 168 %! assert (r, gray); |
169 %! assert (a, alpha) | 169 %! assert (a, alpha); |
170 | 170 |
171 ## typical usage with RGB uint8 images | 171 ## typical usage with RGB uint8 images |
172 %!testif HAVE_MAGICK | 172 %!testif HAVE_MAGICK |
173 %! rgb = randi (255, 10, 10, 3, "uint8"); | 173 %! rgb = randi (255, 10, 10, 3, "uint8"); |
174 %! r = write_and_read (".tif", rgb); | 174 %! r = write_and_read (".tif", rgb); |
175 %! assert (r, rgb) | 175 %! assert (r, rgb); |
176 | 176 |
177 ## RGB uint8 images with alpha channel | 177 ## RGB uint8 images with alpha channel |
178 %!testif HAVE_MAGICK | 178 %!testif HAVE_MAGICK |
179 %! rgb = randi (255, 10, 10, 3, "uint8"); | 179 %! rgb = randi (255, 10, 10, 3, "uint8"); |
180 %! alpha = randi (255, 10, 10, 1, "uint8"); | 180 %! alpha = randi (255, 10, 10, 1, "uint8"); |
181 %! [r, ~, a] = write_and_read (".tif", rgb, "Alpha", alpha); | 181 %! [r, ~, a] = write_and_read (".tif", rgb, "Alpha", alpha); |
182 %! assert (r, rgb) | 182 %! assert (r, rgb); |
183 %! assert (a, alpha) | 183 %! assert (a, alpha); |
184 | 184 |
185 ## multipage RGB uint8 images | 185 ## multipage RGB uint8 images |
186 %!testif HAVE_MAGICK | 186 %!testif HAVE_MAGICK |
187 %! rgb = randi (255, 10, 10, 3, 5, "uint8"); | 187 %! rgb = randi (255, 10, 10, 3, 5, "uint8"); |
188 %! r = write_and_read (".tif", rgb); | 188 %! r = write_and_read (".tif", rgb); |
189 %! assert (r, rgb) | 189 %! assert (r, rgb); |
190 | 190 |
191 ## multipage RGB uint8 images with alpha channel | 191 ## multipage RGB uint8 images with alpha channel |
192 %!testif HAVE_MAGICK | 192 %!testif HAVE_MAGICK |
193 %! rgb = randi (255, 10, 10, 3, 5, "uint8"); | 193 %! rgb = randi (255, 10, 10, 3, 5, "uint8"); |
194 %! alpha = randi (255, 10, 10, 1, 5, "uint8"); | 194 %! alpha = randi (255, 10, 10, 1, 5, "uint8"); |
195 %! [r, ~, a] = write_and_read (".tif", rgb, "Alpha", alpha); | 195 %! [r, ~, a] = write_and_read (".tif", rgb, "Alpha", alpha); |
196 %! assert (r, rgb) | 196 %! assert (r, rgb); |
197 %! assert (a, alpha) | 197 %! assert (a, alpha); |
198 | 198 |
199 %!testif HAVE_MAGICK | 199 %!testif HAVE_MAGICK |
200 %! gray = repmat (uint8 (0:255), 100, 1); | 200 %! gray = repmat (uint8 (0:255), 100, 1); |
201 %! [g] = write_and_read (".jpeg", gray); | 201 %! [g] = write_and_read (".jpeg", gray); |
202 %! assert (g, gray, 2) | 202 %! assert (g, gray, 2); |
203 | 203 |
204 %!testif HAVE_MAGICK | 204 %!testif HAVE_MAGICK |
205 %! gray = repmat (uint8 (0:255), 100, 1); | 205 %! gray = repmat (uint8 (0:255), 100, 1); |
206 %! [g] = write_and_read (".jpeg", gray, "quality", 100); | 206 %! [g] = write_and_read (".jpeg", gray, "quality", 100); |
207 %! assert (g, gray) | 207 %! assert (g, gray); |
208 | 208 |
209 %!function [compression] = get_bmp_compression (ext, cmap = [], varargin) | 209 %!function [compression] = get_bmp_compression (ext, cmap = [], varargin) |
210 %! gray = repmat (uint8 (0:255), 100, 1); | 210 %! gray = repmat (uint8 (0:255), 100, 1); |
211 %! filename = [tempname() ext]; | 211 %! filename = [tempname() ext]; |
212 %! unwind_protect | 212 %! unwind_protect |
226 %! end_unwind_protect | 226 %! end_unwind_protect |
227 %!endfunction | 227 %!endfunction |
228 | 228 |
229 ## BMP images must be saved uncompressed by default (bug #45565) | 229 ## BMP images must be saved uncompressed by default (bug #45565) |
230 %!testif HAVE_MAGICK | 230 %!testif HAVE_MAGICK |
231 %! assert (get_bmp_compression ("", [], "BMP"), 0) | 231 %! assert (get_bmp_compression ("", [], "BMP"), 0); |
232 %! assert (get_bmp_compression ("", [], "bmp"), 0) | 232 %! assert (get_bmp_compression ("", [], "bmp"), 0); |
233 %! assert (get_bmp_compression (".BMP"), 0) | 233 %! assert (get_bmp_compression (".BMP"), 0); |
234 %! assert (get_bmp_compression (".bmp"), 0) | 234 %! assert (get_bmp_compression (".bmp"), 0); |
235 %! assert (get_bmp_compression (".bmp", [], "bmp"), 0) | 235 %! assert (get_bmp_compression (".bmp", [], "bmp"), 0); |
236 %! assert (get_bmp_compression ("", gray (256), "bmp"), 0) | 236 %! assert (get_bmp_compression ("", gray (256), "bmp"), 0); |
237 %! assert (get_bmp_compression (".bmp", gray (256), "Compression", "rle"), 1) | 237 %! assert (get_bmp_compression (".bmp", gray (256), "Compression", "rle"), 1); |