[Index for tmp_for_tar/vrml.doc]
[Return to Master Index]
imginfo
(tmp_for_tar/vrml.doc/imginfo.m)
Function Synopsis
[h,w] = imginfo (fn)
Help text
[h,w] = imginfo (filename) - Get image size from file
hw = imginfo (filename)
filename : string : Name of image file
h : 1 : Height of image, in pixels
w : 1 : Width of image, in pixels
or
hw=[h,w] : 2 : Height and width of image
NOTE : imginfo relies on the 'convert' program.
Last modified: December 2000
Listing of function file tmp_for_tar/vrml.doc/imginfo.m
## [h,w] = imginfo (filename) - Get image size from file
## hw = imginfo (filename)
##
## filename : string : Name of image file
##
## h : 1 : Height of image, in pixels
## w : 1 : Width of image, in pixels
## or
## hw=[h,w] : 2 : Height and width of image
##
## NOTE : imginfo relies on the 'convert' program.
## Author: Etienne Grossmann <etienne@isr.ist.utl.pt>
## Last modified: December 2000
function [h,w] = imginfo (fn)
[res,status] = system(sprintf("convert -verbose %s NULL",fn));
if status,
error (["imginfo : 'convert' exited with status %i ",\
"and produced\n%s\n"],\
status, res);
end
l = length(res);
i = index(res," ");
if ! i,
error ("imginfo : Can't interpret string\n%s\n", res);
end
j = i+index(res(i:l),"x")-1;
k = j+index(res(j:l)," ")-1;
if j-1<=i || k-1<=j,
error ("imginfo : Can't interpret string (2)\n%s\n", res);
end
w = str2num(res(i:j-1));
h = str2num(res(j+1:k));
if nargout<2, h = [h,w]; end
Produced by oct2html on Sat Dec 2 19:08:39 2000
Cross-Directory links are: ON