Mercurial > octave
view scripts/image/private/__imfinfo__.m @ 18298:15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
* image/private/imageIO.m: make this function check existence of the file
and handle URLs. It may also modify the input that imread() and imfinfo()
received to remove the format name if it was given as a separate argument. The
filepath will be modified to give the absolute filepath, and URLs will cause
the file to be downloaded, and the filepath for a temporary will be given (and
the file removed in the end). If the file can't be found it will thrown an error
meaning that if the file is not found, whatever function is set for that format,
it will never be called).
* image/imfinfo.m, image/imread.m: change functions for the modified call to
imageIO() and add new tests.
* image/private/__imfinfo__.m, image/private/__imread__.m: remove parsing of
input, checking for existence of file, and handling of URL since that is now
done by imageIO().
* image/imformats.m: fix tests for the new behaviour.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Thu, 16 Jan 2014 19:12:36 +0000 |
parents | d63878346099 |
children | 4197fc428c7d |
line wrap: on
line source
## Copyright (C) 2008-2013 Soren Hauberg ## Copyright (C) 2013 Carnë Draug ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 3 of the License, or (at ## your option) any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, see ## <http://www.gnu.org/licenses/>. ## This function does all the work of imfinfo. It exists here as private ## function so that imfinfo can use other functions if imformats is ## configured to. It is also needed so that imformats can create a ## function handle for it. ## Author: Soren Hauberg <hauberg@gmail.com> function info = __imfinfo__ (filename) if (nargin != 1) print_usage ("imfinfo"); elseif (! ischar (filename)) error ("imfinfo: FILENAME must be a string"); endif info = __magick_finfo__ (filename); endfunction