Information about graphics file
The format of the file is inferred from its contents.
filenameis a TIFF, PGM, PBM, PPM, HDF, ICO, GIF, SVS, or CUR file containing more than one image, then
infois 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.
Return Information About Graphics File
Find information about the example image,
info = imfinfo('ngc6543a.jpg');
info structure contains the following information fields:
To display information from the structure, for example
info.CodingMethod in the command window.
ans = 'Huffman'
To display all the properties in the structure, type
info in the command window.
filename — Name of graphics file
character vector | string scalar
Name of graphics file, specified as a character vector or string scalar.
Depending on the location of the file,
take on one of these forms.
|Current folder or folder on the MATLAB path
Specify the name of the file in
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.
If the file is located by an internet URL, then
If the file is stored at a remote location,
Based on the remote location,
For more information, see Work with Remote Data.
fmt — Image format
character vector | string scalar
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
info — Information about graphics file
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 describes the nine fields that
are always included.
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.
Date when the file was last modified.
Size of the file, in bytes.
File format, as specified by
File format version.
|character vector or number
Image width, in pixels.
Image height, in pixels. (For additional details about BMP files, see Tips.)
Number of bits per pixel.
Additional fields are included for some file formats:
JPEG, DNG, and TIFF only — If
filenamecontains Exchangeable Image File Format (EXIF) tags, then
'GPSInfo'(global positioning system information) fields.
JPEG only — If
filenamecontains embedded Extensible Metadata Platform (XMP) metadata, then
'XMPData'field. If the XMP metadata of
filenamecontains International Press Telecommunications Council (IPTC) data, this data is located in the
'Iptc4xmpCore'(core metadata) and
'Iptc4xmpExt'(extension metadata) subfields of the
GIF only —
imfinforeturns the value of the
'DelayTime'field in hundredths of seconds.
JPEG2000 only — The
infostructure 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.
DNG only —
imfinforeturns tags belonging to Adobe® DNG file versions up to and including 1.5 as individual named fields in the output structure. For a complete list of DNG file tags, see Chapter 4 of the Adobe Digital Negative (DNG) Specification.
When you use
imfinfoto get information about an Adobe DNG file, it returns the image dimensions of the preview image in the
'Width'fields of the
When you use
imfinfoto get information about a BMP file, it returns an
infostructure that can contain a negative
'Height'value. The negative value indicates that the origin of the image is in its upper-left corner. In such cases, the actual height of the image in pixels is the absolute value of the
Version HistoryIntroduced before R2006a
R2023a: Get information about Extensible Metadata Platform (XMP) metadata embedded in JPEG files
imfinfo function returns XMP metadata embedded in JPEG
files in the
'XMPData' field of the output structure. The
function also returns International Press Telecommunications Council (IPTC) metadata
embedded in the XMP namespace. The IPTC data is stored in the
'Iptc4xmpCore' (core metadata) and
'Iptc4xmpExt' (extension metadata) subfields of
R2021a: Get information about Adobe Digital Negative (DNG) tags
imfinfo function returns information on DNG file tags
belonging to versions up to and including 1.5 as individual named fields in the
output structure. Previously, information on DNG file tags belonging to versions 1.2
through 1.5 was stored in the
'UnknownTags' field of the output
R2019b: Output includes information on multiple images from PGM, PBM, and PPM files
If a PGM, PBM, or PPM file has multiple images, then
now returns a structure array containing information on those multiple images.
imfinfo returned a 1-by-1 structure containing
information about only the first image.