Main Content

exrinfo

Read metadata from EXR file

Since R2022b

Description

info = exrinfo(filename) reads the metadata from the EXR file specified by filename.

example

Examples

collapse all

Read metadata from an EXR file.

info = exrinfo("office.exr");

Examine information about the channels stored in the EXR file. The image contains the four channels R, G, B, and A, which indicates an RGB image with an alpha channel. The pixel values are stored as half-precision values.

info.ChannelInfo
ans=4×3 table
         PixelType    XSubSampling    YSubSampling
         _________    ____________    ____________

    A     "half"           1               1      
    B     "half"           1               1      
    G     "half"           1               1      
    R     "half"           1               1      

Access values for optional EXR metadata attributes. If the EXR metadata does not specify a value for an attribute, the structure returns that attribute as an empty field.

info.AttributeInfo
ans = struct with fields:
           AdoptedNeutral: []
                 Altitude: 181
                 Aperture: []
        CameraFocalLength: []
              CaptureDate: ""
           Chromaticities: [0x0 table]
                 Comments: "Sample EXR Image provided by The MathWorks, Inc. (www.mathworks.com)"
      DWACompressionLevel: []
           EnvironmentMap: ""
             ExposureTime: []
          FramesPerSecond: []
                 ISOSpeed: []
                 Latitude: 42.3015
                Longitude: -71.3761
         LookModTransform: ""
       OriginalDataWindow: []
                    Owner: "Copyright 2022 The MathWorks, Inc."
    PixelsPerInchAlongRow: []
       RenderingTransform: ""
                UTCOffset: []
           WhiteLuminance: []
            WorldToCamera: []
               WorldToNDC: []
                WrapModes: ""

Input Arguments

collapse all

Name of the EXR file, specified as a character vector or string scalar. filename can contain the absolute path to the file, a relative path from the current directory, or a relative path from a directory on the MATLAB® path. The file must be a valid EXR file for which the isexr function returns true.

Data Types: char | string

Output Arguments

collapse all

Information about the EXR metadata, returned as a P-by-1 structure array containing information about each of the P parts of the EXR file. The output structure contains these fields:

FieldDescription
FileNameFile name, including the absolute path and file extension, returned as a string scalar.
PartNamePart name, returned as a string scalar. If the image part does not have a name, then the function returns PartName as "".
PartTypePart type, returned as "Scanline" or "Tiled".
DisplayWindow

Size of the display window, returned as a 4-element vector of integers, of data type double, in the format [xstart ystart xend yend], where:

  • xstart and ystart specify the upper-left corner of the display window, in pixels.

  • xend and yend specify the lower-right corner of the display window, in pixels.

The origin of the pixel coordinate system is (0, 0). The coordinate values can be positive or negative integers.

DataWindow

Extents of the data window, returned as a 4-element vector of integers, of data type double, in the format [xstart ystart xend yend], where:

  • xstart and ystart specify the upper-left corner of the data window, in pixels.

  • xend and yend specify the lower-right corner of the data window, in pixels.

The data window specifies the size and location of the image data stored in the file part. The origin of the pixel coordinate system is (0, 0). The coordinate values can be positive or negative integers. The data window can be smaller or larger than the display window.

LineOrder

Order in which the file part stores image data scanlines or tiles, returned as one of these values:

  • "TopDown" — File stores scanlines or tiles in increasing order in the y-direction.

  • "BottomUp" — File stores scanlines or tiles in decreasing order in the y-direction.

  • "Random" — File stores tiles in random order in the y-direction. This value is valid only for tiled images.

ViewsNames of the views stored in the file part, returned as an m-by-1 string array, where m is the number of views in the file part. If the file part does not contain any view information, then the function returns Views as "".
ChannelInfo

Channel information, returned as a c-by-3 table, where c is the number of image channels in the file part. The name of each row is the name of the corresponding channel. The table has these columns:

  • PixelType — Data type of stored channel data, returned as "half", "single", or "uint32".

  • XSubSampling — Subsampling rate in the x-direction.

  • YSubSampling — Subsampling rate in the y-direction.

Compression

Compression mode used to store the image data, returned as "None", "RLE", "ZIPS", "ZIP", "PIZ", "PXR24", "B44", "B44A", "DWAA", or "DWAB".

ScreenWindowWidthWidth of the screen window, returned as a scalar of data type double.
ScreenWindowCenterxy-coordinates of the screen window center, in pixels, returned as a two-element vector, of data type double, of the form [x y].
PixelAspectRatioRatio of the image width to the image height, returned as a scalar of data type double.
AttributeInfoStructure that contains optional attributes the EXR format supports. See the Attributes in AttributeInfo table for details.
TileInfo

Information about image tiles, returned as a structure with these fields:

  • TileWidth — Width of tiles in pixels, returned as a positive integer.

  • TileHeight — Height of tiles in pixels, returned as a positive integer.

  • LevelMode — Level mode, returned as "SingleLevel", "MipMapLevels", or "RipMapLevels". The "SingleLevel" value corresponds to a single resolution image. The "MipMapLevels" and "RipMapLevels" values correspond to multiresolution images.

  • LevelRoundingMode — Rounding scheme used to write a multiresolution tiled image, specified as "RoundDown" or "RoundUp".

If the file part is a scanline image, then the function returns TileInfo as "".

IsDeepData

Image part contains deep image data, returned as a logical 1 (true) or 0 (false). If true, the image contains a varying number of samples for each channel at each pixel location. If false, the image contains one sample per channel at each pixel location.

Note

MATLAB does not support reading or writing deep image data from EXR files.

This table describes the AttributeInfo structure returned in info. The table lists the AttributeInfo field names, the corresponding attribute names in the EXR specification, and the expected data type of the attribute. If the EXR file does not specify a value for an attribute, or the value is not in the expected data type, then exrinfo returns the attribute as an empty field. For more details about the meaning of these optional attributes, see the OpenEXR Documentation on Standard Attributes.

Attributes in AttributeInfo

Name in AttributeInfo Name in EXR SpecificationExpected Value
AdoptedNeutraladoptedNeutral2-element double vector
Altitudealtitudedouble scalar
Apertureaperturedouble scalar
CameraFocalLengthfocusdouble scalar
CaptureDatecapDatestring scalar
Chromaticitieschromaticities4-by-2 table
Commentscommentsstring scalar
DWACompressionLeveldwaCompressionLeveldouble scalar
EnvironmentMapenvMap"LatLon" or "Cube"
ExposureTimeexpTimedouble scalar
FramesPerSecondframesPerSeconddouble scalar
ISOSpeedisoSpeeddouble scalar
Latitudelatitudedouble scalar
Longitudelongitudedouble scalar
LookModTransformlookModTransformstring scalar
OriginalDataWindoworiginalDataWindow4-element double vector of integers
Ownerownerstring scalar
PixelsPerInchAlongRowxDensitydouble scalar
RenderingTransformrenderingTransformstring scalar
UTCOffsetutcOffsetdouble scalar
WhiteLuminancewhiteLuminancedouble scalar
WorldToCameraworldToCamera4-by-4 double matrix
WorldToNDCworldToNDC4-by-4 double matrix
WrapModeswrapmodesstring scalar

The exrinfo function does not support reading these standard optional attributes: keyCode, timeCode, deepImageState, ID Manifest.

Extended Capabilities

Version History

Introduced in R2022b