M
Martin Stainsby
I'm not sure whether I am approaching this correctly?
I'm trying to get the focal length from exif info stored in an image.
The Visual studio help says it is stored in "An array of two Byte objects
that represent a rational number".
Yet there are eight bytes in the info? shown below.
89 00 00 00 0A 00 00 00
Are these supposed to be 2 byte or 4 byte objects, or am I completely
misunderstanding this rational number gizmo?
Both these if statements below retrieve the correct focal length 13.7 that I
expect, I'm just not sure if I am approaching the problem correctly in
either case?
if(propertyItem.Id == 0x920A)
{
int a = BitConverter.ToInt32(propItems[count].Value,0);
int b = BitConverter.ToInt32(propItems[count].Value,4);
double focalLength = (double)a/b;
}
if(propertyItem.Id == 0x920A)
{
short a = BitConverter.ToInt16(propItems[count].Value,0);
short b = BitConverter.ToInt16(propItems[count].Value,4);
double focalLength = (double)a/b;
}
Some guidance would be really appreciated.
Thanks
Martin.
I'm trying to get the focal length from exif info stored in an image.
The Visual studio help says it is stored in "An array of two Byte objects
that represent a rational number".
Yet there are eight bytes in the info? shown below.
89 00 00 00 0A 00 00 00
Are these supposed to be 2 byte or 4 byte objects, or am I completely
misunderstanding this rational number gizmo?
Both these if statements below retrieve the correct focal length 13.7 that I
expect, I'm just not sure if I am approaching the problem correctly in
either case?
if(propertyItem.Id == 0x920A)
{
int a = BitConverter.ToInt32(propItems[count].Value,0);
int b = BitConverter.ToInt32(propItems[count].Value,4);
double focalLength = (double)a/b;
}
if(propertyItem.Id == 0x920A)
{
short a = BitConverter.ToInt16(propItems[count].Value,0);
short b = BitConverter.ToInt16(propItems[count].Value,4);
double focalLength = (double)a/b;
}
Some guidance would be really appreciated.
Thanks
Martin.