in Matlab I cant't read the image resolution of a jpg file with the
command infinfo.
If I right-click on the file and see his properties, I can see the
image resolution. Why can't Matlab read it?
Is there a way to do so?
Thanks in advance
Azoun
------------------------------------------------------------------------------------------
rgbImageInfo = imfinfo('C:\Program Files\MATLAB\R2010a\toolbox\images
\imdemos\office_4.jpg')
fprintf('The Width=%d\nThe Height=%d\n',...
rgbImageInfo.Width, rgbImageInfo.Height);
rgbImageInfo =
Filename: 'C:\Program Files\MATLAB\R2010a\toolbox\images
\imdemos\office_4.jpg'
FileModDate: '09-Nov-2007 15:21:56'
FileSize: 141990
Format: 'jpg'
FormatVersion: ''
Width: 903
Height: 600
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {}
DigitalCamera: [1x1 struct]
The Width=903
The Height=600
I meant to resolution in dpi.
Yes I can read the number of pixel in X and Y direction, but I would
like to know the number Dots Per Inch of a jpg file
Many thanks
Azoun
Do rgbImageInfo and look for the XResolution and YResolution. These are
the DPI values
EDU>> rgbImageInfo = foo.jpg')
rgbImageInfo =
Filename: 'foo.jpg'
FileModDate: '13-Mar-2011 04:23:00'
FileSize: 60932
Format: 'jpg'
FormatVersion: ''
Width: 415
Height: 205
BitDepth: 24
ColorType: 'truecolor'
FormatSignature: ''
NumberOfSamples: 3
CodingMethod: 'Huffman'
CodingProcess: 'Sequential'
Comment: {}
Orientation: 1
XResolution: 100
YResolution: 100
ResolutionUnit: 'Inch'
Software: 'Adobe Photoshop CS Macintosh '
DateTime: '2009:07:13 16:23:06 '
DigitalCamera: [1x1 struct]
ExifThumbnail: [1x1 struct]
To change DPI, I use IrfanView. It is free software. Open the jpg file
in it, then do image->Information, you'll see the DPI there. Change it
as needed, then make sure to save the image.
--Nasser