Mercurial > octave-antonio
diff scripts/image/imread.m @ 16913:d0558ee259ad
Connect imread with imformats.
* private/core_imread.m: new function. Old code from imread() moved here just
like what happened to imfinfo(). See message on cset bfad37d33435
* imfinfo.m: reduced to minimum input check, until finding filename. Passes
all arguments to imageIO().
* imformats.m: change calls to imread() to the new core_imread().
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sun, 07 Jul 2013 18:26:25 +0100 |
parents | e2de3c8882be |
children | 1b3b3ee88284 |
line wrap: on
line diff
--- a/scripts/image/imread.m Sun Jul 07 19:07:23 2013 +0200 +++ b/scripts/image/imread.m Sun Jul 07 18:26:25 2013 +0100 @@ -42,60 +42,15 @@ ## @end deftypefn function varargout = imread (filename, varargin) - if (nargin < 1) print_usage (); - endif - - if (! ischar (filename)) + elseif (! ischar (filename)) error ("imread: FILENAME must be a string"); endif - - filename = tilde_expand (filename); - - fn = file_in_path (IMAGE_PATH, filename); - - if (isempty (fn)) - error ("imread: cannot find %s", filename); - endif - - try - [varargout{1:nargout}] = __magick_read__ (fn, varargin{:}); - catch - - magick_error = lasterr (); - - img_field = false; - x_field = false; - map_field = false; - - try - vars = load (fn); - if (isstruct (vars)) - img_field = isfield (vars, "img"); - x_field = isfield (vars, "X"); - map_field = isfield (vars, "map"); - endif - catch - error ("imread: invalid image file: %s", magick_error); - end_try_catch - - if (map_field && (img_field || x_field)) - varargout{2} = vars.map; - if (img_field) - varargout{1} = vars.img; - else - varargout{1} = vars.X; - endif - else - error ("imread: invalid Octave image file format"); - endif - - end_try_catch - + varargout{1:nargout} = imageIO (@core_imread, "read", filename, + filename, varargin{:}); endfunction - %!testif HAVE_MAGICK %! vpng = [ ... %! 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, ...