Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

imfinfo - Information about graphics file

Syntax

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

Description

info = imfinfo(filename,fmt) returns a structure whose fields contain information about an image in a graphics file. filename is a string that specifies the name of the graphics file, and fmt is a string that specifies the format of the file. The file must be in the current folder or in a folder on the MATLAB path. If imfinfo cannot find a file named filename, it looks for a file named filename.fmt. The possible values for fmt are contained in the MATLAB file format registry. To view of list of these formats, run the imformats command.

If filename is a TIFF, HDF, ICO, GIF, or CUR file containing more than one image, 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) attempts to infer the format of the file from its contents.

info = imfinfo(URL,...) reads the image from the specified Internet URL. The URL must include the protocol type (e.g., http://)

Information Returned

The set of fields in info depends on the individual file and its format. However, the first nine fields are always the same. This table lists these common fields, in the order they appear in the structure, and describes their values. Format-Specific Notes contains information about some fields returned by certain formats.

Field

Value

Filename

A string containing the name of the file; if the file is not in the current folder, the string contains the full pathname of the file.

FileModDate

A string containing the date when the file was last modified

FileSize

An integer indicating the size of the file in bytes

Format

A string containing the file format, as specified by fmt; for formats with more than one possible extension (e.g. JPEG and TIFF files), imfinfo returns the first variant in the file format registry.

FormatVersion

A string or number describing the file format version

Width

An integer indicating the width of the image in pixels

Height

An integer indicating the height of the image in pixels

BitDepth

An integer indicating the number of bits per pixel

ColorType

A string indicating the type of image; this can include, but is not limited to, 'truecolor' for a truecolor (RGB) image, 'grayscale' for a grayscale intensity image, or 'indexed' for an indexed image

Format-Specific Notes

Example

info = imfinfo('canoe.tif')

info = 

                     Filename: [1x76 char]
                  FileModDate: '04-Dec-2000 13:57:55'
                     FileSize: 69708
                       Format: 'tif'
                FormatVersion: []
                        Width: 346
                       Height: 207
                     BitDepth: 8
                    ColorType: 'indexed'
              FormatSignature: [73 73 42 0]
                    ByteOrder: 'little-endian'
               NewSubFileType: 0
                BitsPerSample: 8
                  Compression: 'PackBits'
    PhotometricInterpretation: 'RGB Palette'
                 StripOffsets: [9x1 double]
              SamplesPerPixel: 1
                 RowsPerStrip: 23
              StripByteCounts: [9x1 double]
                  XResolution: 72
                  YResolution: 72
               ResolutionUnit: 'Inch'
                     Colormap: [256x3 double]
          PlanarConfiguration: 'Chunky'
                    TileWidth: []
                   TileLength: []
                  TileOffsets: []
               TileByteCounts: []
                  Orientation: 1
                    FillOrder: 1
             GrayResponseUnit: 0.0100
               MaxSampleValue: 255
               MinSampleValue: 0
                 Thresholding: 1
                       Offset: 67910

See Also

imformats, imread, imwrite

Bit-Mapped Images for related functions

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS