Wednesday, November 26, 2008

Information about your image

One of the cool features of Matlab is its ability to gather info about image files. Using the imfinfo command we can get a ton of info ... some of it useful, some of it ... not so much.

Using the command on a JPEG image produces the above information. I used the imshow command to bring up the figure in the foreground. We get file size, bit depth, the modified date, and so on.

ans =

Filename: [1x45 char]
FileModDate: '19-Oct-2008 20:46:58'
FileSize: 74848
Format: 'jpg'
FormatVersion: ''
Width: 600
Height: 397
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {}

A Tiff image yields so much more information. We can get compression info, resolution details, and Byte order (which we can match to the hex dump (49 49 = "little endian") ... among other things.

ans =

Filename: [1x40 char]
FileModDate: '02-Oct-2006 10:48:00'
FileSize: 94710
Format: 'tif'
FormatVersion: []
Width: 294
Height: 294
BitDepth: 8
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: 8
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: 8274
SamplesPerPixel: 1
RowsPerStrip: 294
StripByteCounts: 86436
XResolution: 72
YResolution: 72
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 255
MinSampleValue: 0
Thresholding: 1
ICCProfileOffset: 7874

This info can be helpful in preparing reports or for verifying other people's work.

Matlab is a great program on its own. Even better, you can use it to control Photoshop (more on that later).

No comments: