X,Y Resolution

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Post Reply
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

X,Y Resolution

Post by madiazg »

Hello,
I have problems to store the X and Y Resolution of a photo
This datas are Rational's type.
Can you tell me how to be added X and Y Resolution to the EXIF information of the picture?
Regards...
Miguel Angel
http://imagen3d.site88.net
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Post by dominique »

For X, Y resolution, I'm not shure is what you need but try to modifiy Xdpi and Ydpi in the GFL_BITMAP structure.

For other EXIF field : http://newsgroup.xnview.com/viewtopic.p ... light=exif
Dom
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Post by madiazg »

Hello Dom
In the EXIF data, Xdpi and Ydpi are datas type Rational.
I tried to save these data as follows:

Code: Select all

gflBitmapSetEXIFValueRational2(EXIF2, 1, 283, P, Q); //yDpi
but I can not find appropriate values of P and Q so that the resolution was well saved.

To DPI = 200, what values of P and Q should I indicate in gflBitmapSetEXIFValueRational2?

Regards...
Miguel Angel
http://imagen3d.site88.net
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Post by dominique »

I dont know ! I never try this.
As a rationnal is determine by the ratio P/Q, you should try P = 200 and Q = 1
Dom
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Post by madiazg »

Hello DOM
according to the information I have obtained:

XResolution
The number of pixels per ResolutionUnit in the ImageWidth direction. When the image resolution is unknown, 72
[dpi] is designated.
Tag = 282 (11A.H)
Type = RATIONAL
Count = 1
Default = 72

If I use the values P = 200 and Q = 1, the result is:

X Resolution: 134228553/67108864


For me, this is a mystery!

Regards...
Miguel Angel
http://imagen3d.site88.net
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Post by madiazg »

I have found this information:

IFD data structure
At Exif format, the first IFD is IFD0(IFD of main image), then it links to IFD1(IFD of thumbnail image) and IFD link is terminated. But IFD0/IFD1 doesn't contain any digicam's information such as shutter speed, focal length etc. IFD0 always contains special Tag Exif Offset(0x8769), it shows an offset to Exif SubIFD. Exif SubIFD is IFD formatted data also, it contains digicam's information.

0000: 49 49 2A 00 08 00 00 00-02 00 1A 01 05 00 01 00
0010: 00 00 26 00 00 00 69 87-04 00 01 00 00 00 11 02
0020: 00 00 40 00 00 00 48 00-00 00 01 00 00 00

If the first part of TIFF data is above, it can read as;

* The first 2bytes are "I I", byte align is 'Intel'.
* Address 0x0004~0x0007 is 0x08000000, IFD0 starts from address '0x0008'
* Address 0x0008~0x0009 is 0x0200, number of directory entry of IFD0 is '2'.
* Address 0x000a~0x000b is 0x1A01, it means this is a XResolution(0x011A) Tag, it contains a horizontal resolution of image.
* Address 0x000c~0x000d is 0x0500, format of this value is unsigned rational(0x0005).
* Address 0x000e~0x0011 is 0x01000000, number of components is '1'. Unsigned rational's data size is 8bytes/components, so total data length is 1x8=8bytes.
* Total data length is larger than 4bytes, so next 4bytes contains an offset to data.
* Address 0x0012~0x0015 is 0x26000000, XResolution data is stored to address 0x0026
* Address 0x0026~0x0029 is 0x48000000, numerator is 72, address 0x002a~0x002d is 0x0100000000, denominator is '1'. So the value of XResoultion is 72/1.


In an original image, the EXIF data for the resolution are:

Tag:282
ifd:1
NComp:1
Value:0
DLengt:8
Data:.......

If I save the EXIF information:

Code: Select all

gflBitmapSetEXIFValueRational2(EXIF2, 1, 282, 72, 1);
I get the followings datas:

Tag:282
ifd:1
NComp:2
Value:0
DLength:16
Data: .....

procedure gflBitmapSetEXIFValueRational2(exif: PGFL_EXIF_DATAEX; ifd, tag: GFL_UINT16; p,q: GFL_UINT32); stdcall;

do you find some explanation?

Regards...
Miguel Angel
http://imagen3d.site88.net
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Re: X,Y Resolution

Post by dominique »

Do you have some news about EXIF X/Y resolution ?
Rgds
Dom
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Re: X,Y Resolution

Post by madiazg »

I have no new information about this topic. I hoped that you would find the solution to record the resolution. I am also very keen to record the GPS data (http://newsgroup.xnview.com/viewtopic.php?f=4&t=16903).
What information do you need?
How can I help you?
Regards...
Miguel Angel
http://imagen3d.site88.net
User avatar
xnview
Author of XnView
Posts: 43598
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: X,Y Resolution

Post by xnview »

dominique wrote:Do you have some news about EXIF X/Y resolution ?
I've sent a version to dominique for testing...
Pierre.
User avatar
dominique
Posts: 72
Joined: Thu Nov 08, 2007 9:22 am

Re: X,Y Resolution

Post by dominique »

Testing OK ! Continue testing with other EXIF values.

Code: Select all

#define MY_EXIF_X_RESOLUTION                         0x011A
#define MY_EXIF_Y_RESOLUTION                         0x011B
gflBitmapSetEXIFValueRational2(GFL_EXIF_DATAEX* exif, GFL_EXIF_MAIN_IFD, MY_EXIF_X_RESOLUTION, 200, 1);     // For 200 dpi
gflBitmapSetEXIFValueRational2(GFL_EXIF_DATAEX* exif, GFL_EXIF_MAIN_IFD, MY_EXIF_Y_RESOLUTION, 200, 1);     // For 200 dpi
Good Job !
Thx Pierre

PS : for EXIF Tags values : http://www.sno.phy.queensu.ca/~phil/exi ... /EXIF.html

Edit : Several modifications and it will be ok
Dom
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias
Contact:

Re: X,Y Resolution

Post by madiazg »

Is it a new version of GFL SDK?
Do you have done tests with the GPS data?
Regards...
Miguel Angel
http://imagen3d.site88.net
Post Reply