This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Information about graphics file


info = imfinfo(filename)
info = imfinfo(filename,fmt)
info = imfinfo(URL)



info = imfinfo(filename) returns a structure whose fields contain information about an image in a graphics file, filename.

The format of the file is inferred from its contents.

  • If filename is a TIFF, HDF, ICO, GIF, or CUR file containing more than one image, then info is a structure array with one element for each image in the file. For example, info(3) would contain information about the third image in the file.

info = imfinfo(filename,fmt) additionally looks for a file named filename.fmt, if MATLAB® cannot find a file named filename.

info = imfinfo(URL) returns information about the image at the specified internet resource, URL.


collapse all

Find information about the example image, ngc6543a.jpg.

info = imfinfo('ngc6543a.jpg');

The info structure contains the following information fields: Filename, FileModDate, FileSize, Format, FormatVersion, Width, Height, BitDepth, ColorType, FormatSignature, NumberOfSamples, CodingMethod, CodingProcess, and Comment.

To display information from the structure, for example CodingMethod, type info.CodingMethod in the command window.

ans = 

To display all the properties in the structure, type info in the command window.

Input Arguments

collapse all

Name of graphics file, specified as a character vector or string scalar.

Depending on the location of the file, filename can take on one of these forms.



Current folder or folder on the MATLAB path

Specify the name of the file in filename.

Example: 'myImage.jpg'

File in a folder

If the file is not in the current folder or in a folder on the MATLAB path, then specify the full or relative path name.

Example: 'C:\myFolder\myImage.ext'

Example: '\imgDir\myImage.ext'


If the file is located by an internet URL, then filename must contain the protocol type such as, http://.

Example: 'http://hostname/path_to_file/my_image.jpg'

Remote Location

(Amazon S3™, Windows Azure® Blob Storage, and HDFS™)

If the file is stored at a remote location, then filename must contain the full path of the file specified as an internationalized resource identifier (IRI) of the form:

For more information, see Work with Remote Data.

Example: 's3://bucketname/path_to_file/my_image.jpg'

Data Types: char | string

Image format, specified as a character vector or string scalar. The possible values for fmt are contained in the MATLAB file format registry. To view of list of these formats, run the imformats command.

Example: 'gif'

Data Types: char | string

Output Arguments

collapse all

Information about the graphics file, returned as a structure array. The set of fields in info depends on the individual file and its format. This table lists the nine fields that always appear, and describes their values.

Field Name




Name of the file or the internet URL specified. If the file is not in the current folder, the character vector contains the full path name of the file.

character vector


Date when the file was last modified.

character vector


Size of the file, in bytes.



File format, as specified by fmt. For formats with more than one possible extension (for example, JPEG and TIFF files), imfinfo returns the first variant in the file format registry.

character vector


File format version.

character vector or number


Image width, in pixels.



Image height, in pixels.



Number of bits per pixel.



Image type. ColorType includes, but is not limited to, 'truecolor' for a truecolor (RGB) image, 'grayscale' for a grayscale intensity image, or 'indexed' for an indexed image.

character vector

Additional fields returned by some file formats:

  • JPEG and TIFF only — If filename contains Exchangeable Image File Format (EXIF) tags, then info might also contain 'DigitalCamera' or 'GPSInfo' (global positioning system information) fields.

  • GIF onlyimfinfo returns the value of the 'DelayTime' field in hundredths of seconds.

  • JPEG2000 only — The info structure contains an m-by-3 cell array, 'ChannelDefinition'. The first column of 'ChannelDefinition' reports a channel position as it exists in the file. The second column reports the type of channel, and the third column reports the channel mapping.

Introduced before R2006a