Mercurial > octave
annotate scripts/image/imfinfo.m @ 33608:5fba13104493 bytecode-interpreter tip
maint: merge default to bytecode-interpreter.
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Sat, 18 May 2024 22:40:00 -0400 |
parents | 2e484f9f1f18 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31706
diff
changeset
|
3 ## Copyright (C) 2008-2024 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
7 ## |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
8 ## This file is part of Octave. |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24049
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24049
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22558
diff
changeset
|
13 ## (at your option) any later version. |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
14 ## |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22558
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22558
diff
changeset
|
18 ## GNU General Public License for more details. |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
19 ## |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24049
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
25 |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
26 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20158
diff
changeset
|
27 ## @deftypefn {} {@var{info} =} imfinfo (@var{filename}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20158
diff
changeset
|
28 ## @deftypefnx {} {@var{info} =} imfinfo (@var{url}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20158
diff
changeset
|
29 ## @deftypefnx {} {@var{info} =} imfinfo (@dots{}, @var{ext}) |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
30 ## Read image information from a file. |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
31 ## |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
32 ## @code{imfinfo} returns a structure containing information about the image |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
33 ## stored in the file @var{filename}. If there is no file @var{filename}, |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
34 ## and @var{ext} was specified, it will look for a file named @var{filename} |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
35 ## and extension @var{ext}, i.e., a file named @var{filename}.@var{ext}. |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
36 ## |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
37 ## The output structure @var{info} contains the following fields: |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
38 ## |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
39 ## @table @samp |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
40 ## @item Filename |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
41 ## The full name of the image file. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
42 ## |
17350 | 43 ## @item FileModDate |
44 ## Date of last modification to the file. | |
45 ## | |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
46 ## @item FileSize |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
47 ## Number of bytes of the image on disk |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
48 ## |
17350 | 49 ## @item Format |
50 ## Image format (e.g., @qcode{"jpeg"}). | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
51 ## |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
52 ## @item Height |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
53 ## Image height in pixels. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
54 ## |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
55 ## @item Width |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
56 ## Image Width in pixels. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
57 ## |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
58 ## @item BitDepth |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
59 ## Number of bits per channel per pixel. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
60 ## |
17350 | 61 ## @item ColorType |
62 ## Image type. Value is @qcode{"grayscale"}, @qcode{"indexed"}, | |
63 ## @qcode{"truecolor"}, @qcode{"CMYK"}, or @qcode{"undefined"}. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
64 ## |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
65 ## @item XResolution |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
66 ## X resolution of the image. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
67 ## |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
68 ## @item YResolution |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
69 ## Y resolution of the image. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
70 ## |
17350 | 71 ## @item ResolutionUnit |
72 ## Units of image resolution. Value is @qcode{"Inch"}, | |
73 ## @qcode{"Centimeter"}, or @qcode{"undefined"}. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
74 ## |
17350 | 75 ## @item DelayTime |
25003
2365c2661b3c
doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
76 ## Time in @nospell{1/100ths} of a second (0 to 65535) which must expire before |
20158
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
77 ## displaying the next image in an animated sequence. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
78 ## |
17350 | 79 ## @item LoopCount |
80 ## Number of iterations to loop an animation. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
81 ## |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
82 ## @item ByteOrder |
21546
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
83 ## Endian option for formats that support it. Value is |
f7f97d7e9294
doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
84 ## @qcode{"little-endian"}, @qcode{"big-endian"}, or @qcode{"undefined"}. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
85 ## |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
86 ## @item Gamma |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
87 ## Gamma level of the image. The same color image displayed on two different |
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
88 ## workstations may look different due to differences in the display monitor. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
89 ## |
17350 | 90 ## @item Quality |
91 ## JPEG/MIFF/PNG compression level. Value is an integer in the range [0 100]. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
92 ## |
17350 | 93 ## @item DisposalMethod |
94 ## Only valid for GIF images, control how successive frames are rendered (how | |
95 ## the preceding frame is disposed of) when creating a GIF animation. Values | |
96 ## can be @qcode{"doNotSpecify"}, @qcode{"leaveInPlace"}, @qcode{"restoreBG"}, | |
97 ## or @qcode{"restorePrevious"}. For non-GIF files, value is an empty string. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
98 ## |
17350 | 99 ## @item Chromaticities |
100 ## Value is a 1x8 Matrix with the x,y chromaticity values for white, red, | |
101 ## green, and blue points, in that order. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
102 ## |
17350 | 103 ## @item Comment |
104 ## Image comment. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
105 ## |
17350 | 106 ## @item Compression |
107 ## Compression type. Value can be @qcode{"none"}, @qcode{"bzip"}, | |
108 ## @qcode{"fax3"}, @qcode{"fax4"}, @qcode{"jpeg"}, @qcode{"lzw"}, | |
109 ## @qcode{"rle"}, @qcode{"deflate"}, @qcode{"lzma"}, @qcode{"jpeg2000"}, | |
110 ## @qcode{"jbig2"}, @qcode{"jbig2"}, or @qcode{"undefined"}. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
111 ## |
17350 | 112 ## @item Colormap |
113 ## Colormap for each image. | |
114 ## | |
115 ## @item Orientation | |
116 ## The orientation of the image with respect to the rows and columns. Value | |
117 ## is an integer between 1 and 8 as defined in the TIFF 6 specifications, and | |
17513
fedcd3717ebc
doc: grammarcheck of documentation before 3.8 release.
Rik <rik@octave.org>
parents:
17359
diff
changeset
|
118 ## for @sc{matlab} compatibility. |
17359
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
119 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
120 ## @item Software |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
121 ## Name and version of the software or firmware of the camera or image input |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
122 ## device used to generate the image. |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
123 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
124 ## @item Make |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
125 ## The manufacturer of the recording equipment. This is the manufacture of the |
17514
5b916efea542
doc: spellcheck of documentation before 3.8 release.
Rik <rik@octave.org>
parents:
17513
diff
changeset
|
126 ## @nospell{DSC}, scanner, video digitizer or other equipment that generated |
5b916efea542
doc: spellcheck of documentation before 3.8 release.
Rik <rik@octave.org>
parents:
17513
diff
changeset
|
127 ## the image. |
17359
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
128 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
129 ## @item Model |
20158
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
130 ## The model name or model number of the recording equipment as mentioned on |
7503499a252b
doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
131 ## the field @qcode{"Make"}. |
17359
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
132 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
133 ## @item DateTime |
17513
fedcd3717ebc
doc: grammarcheck of documentation before 3.8 release.
Rik <rik@octave.org>
parents:
17359
diff
changeset
|
134 ## The date and time of image creation as defined by the Exif standard, i.e., |
17359
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
135 ## it is the date and time the file was changed. |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
136 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
137 ## @item ImageDescription |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
138 ## The title of the image as defined by the Exif standard. |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
139 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
140 ## @item Artist |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
141 ## Name of the camera owner, photographer or image creator. |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
142 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
143 ## @item Copyright |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
144 ## Copyright notice of the person or organization claiming rights to the image. |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
145 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
146 ## @item DigitalCamera |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
147 ## A struct with information retrieved from the Exif tag. |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
148 ## |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
149 ## @item GPSInfo |
cf5d41cc3695
Expand imfinfo to read Exif tags and GPS information.
Carnë Draug <carandraug@octave.org>
parents:
17350
diff
changeset
|
150 ## A struct with geotagging information retrieved from the Exif tag. |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
151 ## @end table |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
152 ## |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
153 ## @seealso{imread, imwrite, imshow, imformats} |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
154 ## @end deftypefn |
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
155 |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
156 function info = imfinfo (filename, varargin) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21575
diff
changeset
|
157 |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
158 if (nargin < 1 || nargin > 2) |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
159 print_usage (); |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
160 elseif (! ischar (filename)) |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
161 error ("imfinfo: FILENAME must be a string"); |
24049
6782105f1820
imfinfo.m: Fix error when a second argument is used (bug #52041).
Mike Miller <mtmiller@octave.org>
parents:
23416
diff
changeset
|
162 elseif (nargin > 1 && ! ischar (varargin{1})) |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
163 error ("imfinfo: EXT must be a string"); |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
164 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21575
diff
changeset
|
165 |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
166 info = imageIO ("imfinfo", @__imfinfo__, "info", filename, varargin{:}); |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21575
diff
changeset
|
167 |
8144
01fac748b680
Add the 'imfinfo' function for reading image file information.
sh@sh-laptop
parents:
diff
changeset
|
168 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17281
diff
changeset
|
169 |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21575
diff
changeset
|
170 |
21575
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
171 ## This test is the same as the similar one in imread. imfinfo must check |
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21546
diff
changeset
|
172 ## if file exists before calling __imfinfo_. This BIST test confirms this. |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
173 %!testif HAVE_MAGICK |
23416
a40434df6f54
Rename warning ID GraphicsMagic-Quantum-Depth GraphicsMagick-Quantum-Depth.
Carnë Draug <carandraug@octave.org>
parents:
23220
diff
changeset
|
174 %! warning ("off", "Octave:GraphicsMagick-Quantum-Depth", "local"); |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
175 %! fmt = fmt_ori = imformats ("jpg"); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
176 %! fmt.info = @true; |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
177 %! error_thrown = false; |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
178 %! imformats ("update", "jpg", fmt); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
179 %! unwind_protect |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
180 %! try |
22558
1751d490dc2f
test: Change tests w/imread to use names without spaces (bug #49219).
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
181 %! imread ("I_sure_hope_this_file_does_not_exist.jpg"); |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
182 %! catch |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
183 %! error_thrown = true; |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
184 %! end_try_catch |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
185 %! unwind_protect_cleanup |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
186 %! imformats ("update", "jpg", fmt_ori); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
187 %! end_unwind_protect |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17744
diff
changeset
|
188 %! assert (error_thrown, true); |
24049
6782105f1820
imfinfo.m: Fix error when a second argument is used (bug #52041).
Mike Miller <mtmiller@octave.org>
parents:
23416
diff
changeset
|
189 |
6782105f1820
imfinfo.m: Fix error when a second argument is used (bug #52041).
Mike Miller <mtmiller@octave.org>
parents:
23416
diff
changeset
|
190 ## Test input validation |
28896
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
191 %!error <Invalid call> imfinfo () |
90fea9cc9caa
test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents:
27978
diff
changeset
|
192 %!error <Invalid call> imfinfo (1,2,3) |
24049
6782105f1820
imfinfo.m: Fix error when a second argument is used (bug #52041).
Mike Miller <mtmiller@octave.org>
parents:
23416
diff
changeset
|
193 %!error <FILENAME must be a string> imfinfo (1) |
6782105f1820
imfinfo.m: Fix error when a second argument is used (bug #52041).
Mike Miller <mtmiller@octave.org>
parents:
23416
diff
changeset
|
194 %!error <EXT must be a string> imfinfo ("foo", 1) |