Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

  • 2 Pages
  • 1
  • 2
  • >
Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, August 12, 2009 1:56:50 AM(UTC)
dominique

Groups: Registered
Posts: 16


Dear support,
I try to understand what is the difference between this two functions : L_ReadFileComment and L_ReadFileTag
Testings this functions, I guess the first one read only string tags and the second one read every tags in every IFD of the image file. Am I wrong? I can't find any answer in the help or in the forum.
Thanks !

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, August 12, 2009 7:34:02 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

Comments and tags are similar in some ways. They are both meta data objects that exist in some file formats.
However, they are not identical. Tags exist in TIFF files but not in other formats. Some comments exist in TIFF files too, and some comments exist in other formats such as JPEG (JFIF) and Exif.

The list of tags is explained in the help topic for L_SetTag.
There are different lists of comments, and you can find a summary in the help topic L_SetComment.

 
#3 Posted : Wednesday, August 12, 2009 10:17:24 AM(UTC)
dominique

Groups: Registered
Posts: 16


Not as clear as I hope [:D]
I was disturbed by the TagID for comments and TagID for tags.
In
one hand this tags are used for the internal comments array and on the other hand, tagid are the real exif tags... Not easy to use.
Why Leadtool does not use diffrents structures for EXIF, IPTC... and use defined IFD to make a more easy to use API?

PS : I post a new thread instead of reply, sorry for this... may a moderator can delete the thread titled Tags and Comments. Thank you
 
#4 Posted : Thursday, August 13, 2009 5:27:47 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

I searched our API help file and did not find any parameter or identifier called 'TagID'. What exactly do you mean by it?

About the internal comments array, the index you need to use for a particular comment will be the same for all file formats.
For example, the value of CMNT_SZDESC is 3, and you can use it with GIF, TIFF, PNG, EXIF, LEAD CMP and JPEG images.

About IFD, you simply need to use the correct page number when dealing with multi-page TIFF files.

If you are still facing problems with comments or tags, please try any example from our help file and if you can't get it to do what you need, send us the details and we will try to help you.

 
#5 Posted : Monday, August 17, 2009 10:46:33 PM(UTC)
dominique

Groups: Registered
Posts: 16


I have a simple example.
I try to read the Exif X Resolution data.
I use CMNT_FOCALPLANEXRESOLUTION tag type with L_ReadFileComment function. This function returns 0 :
L_UINT l_Size = L_ReadFileComment(m_FileName.c_bstr(), CMNT_FOCALPLANEXRESOLUTION, NULL, 0, NULL);

I use L_ReadFileTag with the exif tag id 0x011A (exif tag id for x resolution) and I get a size of 8 (rationnal made with 2 integers) :
l_Size = L_ReadFileTag(m_FileName.c_bstr(), 0x11a, &l_Type, &l_Count, NULL, NULL);

My question is what type of comments can I read with L_ReadFileComment ? Using this function I should read CMNT_FOCALPLANEXRESOLUTION but I must miss something ! Documentation is not clear enougth for me, sorry !

Thank you for your healp
 
#6 Posted : Tuesday, August 18, 2009 6:38:33 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

Are you sure the file you tested contains the CMNT_FOCALPLANEXRESOLUTION? This is not the same as the DPI resolution.
Can you attach the file or email it to support@leadtools.com
If you want to send us the file, please put it in a ZIP or RAR file to ensure our servers deliver it correctly.

 
#7 Posted : Tuesday, August 18, 2009 7:02:46 AM(UTC)
dominique

Groups: Registered
Posts: 16


Ok not easy to send the file but I can do more test like adding CMNT_FOCALPLANEXRESOLUTION to the output file and see if there is any differences. If I can't have the expected result, I will try to give you an image.
Thx for your support.
 
#8 Posted : Tuesday, August 25, 2009 10:46:15 PM(UTC)
dominique

Groups: Registered
Posts: 16


I done some tests to add other comments with L_SetComment and it worked.
I added all possible comments specified int the Ltfil.h header with default string values like "CMNT" + IntToStr(i) (i define with a loop from CMNT_IPTC_FIRST to CMNT_IPTC_LAST for example).
Now I guess that some comments need special string formats and I think I will find them with google.
 
#9 Posted : Wednesday, August 26, 2009 1:11:14 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

The formats of IPTC comments are mentioned in the help topic "IPTC Comments", including the separator used, the date format and the time format. You can find an online copy of the topic here:
http://www.leadtools.com/Help/LEADTOOLS/v16/Main/API/Dllaux/IPTC_Comments.htm

 
#10 Posted : Wednesday, August 26, 2009 10:44:51 PM(UTC)
dominique

Groups: Registered
Posts: 16


Thank you,

For EXIF comments I do this way, tell me if I'm wrong :

--------------------------------------------------------------
// Write a unsigned rationnal
L_UINT __fastcall TProcThread::writeUnsignedRationnalComment(L_UINT16 l_TagId, unsigned int l_P, unsigned int l_Q)
{
        unsigned int *lp_buff = new unsigned int[2];
        memset(lp_buff, 0, 2 * sizeof(unsigned int));
        lp_buff[0] = l_P;
        lp_buff[1] = l_Q;
        L_UINT l_Ret = L_SetComment(l_TagId, (unsigned char*)lp_buff, 2 * sizeof(unsigned int));
        delete [] lp_buff;
        return l_Ret;
}
// And call this function this way :
writeUnsignedRationnalComment(CMNT_FOCALPLANEXRESOLUTION, 300, 1);
--------------------------------------------------------------

Details on EXIF data storing here : http://www.sno.phy.queen...ftool/TagNames/EXIF.html

 
#11 Posted : Thursday, August 27, 2009 3:10:47 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

The code looks correct to me. If you face any problem, please send us the details and we will check it.

 
#12 Posted : Monday, October 5, 2009 7:30:27 AM(UTC)
dominique

Groups: Registered
Posts: 16


I have no more problems using comments or tag functions.
I 'd like to know who I can change the EXIF X/Y Resolution.
I found the comment CMNT_FOCALPLANEXRESOLUTION but it's not the one I'd like to change. Is there any other way to change Exif Resolution (other type of comments? can't find in the help)?
In the same way I'd like to change the header resolution without loading the image.
Regards.
 
#13 Posted : Tuesday, October 6, 2009 5:47:11 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

In Exif files, the X and Y resolution values are stored as TIFF tags of type Rational, and their values are 282 = (11A)hex and 283 = (11B)hex.

If you change these tags, you will change the resolution of the image without having to load it.

 
#14 Posted : Tuesday, October 6, 2009 6:32:17 AM(UTC)
dominique

Groups: Registered
Posts: 16


Ok, thank you very much !
 
#15 Posted : Wednesday, October 7, 2009 10:28:12 PM(UTC)
dominique

Groups: Registered
Posts: 16


That works fine !
I just have a last question (I hope [:)]) : is there any way to know if the data to store should be in little or big endian ?
Example : Resolution unit tag is 0x0128 (unsigned short). I want to write 0x0002 (unit is Inch).
Thank you !
 
#16 Posted : Thursday, October 8, 2009 6:16:03 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

If your question is about the byte order of the tag value in Intel vs. Motorola TIFF files, the answer is that the order should match that of the rest of the file.
This means for an integer value of 0128. In a Motorola file (big endian) the bytes would be "01 28".
In an Intel (little endian) TIFF file, the bytes stored would be "28 01".

If you use our tags functions, you don't need to worry about that. Our functions will use the correct byte order.
 
#17 Posted : Thursday, October 8, 2009 7:01:53 AM(UTC)
dominique

Groups: Registered
Posts: 16


That's it ! I don't have to exchange byte order, great !
For exemple :
If I want to set the tag 0x0128 (resolution unit) to inches, I just have to do write a L_UCHAR buffer filled with 0x0002 like this
L_UCHAR *mp_Buff = new L_UCHAR[2];
mp_Buff[0] = 0x00;
mp_Buff[1] = 0x02;
And then write the tag with L_SetTag ?

 
#18 Posted : Sunday, October 11, 2009 7:01:34 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

The idea is correct, but the values are not.
The tag is rational, which means it takes 4 bytes for the numerator and another 4 for the denominator, which is an array of 2 numbers, each being 32-bit.
The code will look like this:
L_UINT32 resTag[2] = {175, 1}; // res = 175/1 == 175.0 dots per inch.
L_SetTag(0x11A, TAG_RATIONAL, 1, resTag); //X Res
L_SetTag(0x11B, TAG_RATIONAL, 1, resTag); //Y Res
L_WriteFileTag(TEXT("motorola.tif"), (pSAVEFILEOPTION)NULL);

The same code will work for a Motorola and for an Intel byte order TIFF file.
 
#19 Posted : Monday, October 12, 2009 10:01:22 AM(UTC)
dominique

Groups: Registered
Posts: 16


Ok with this but I want to be shure for the unsigned short byte order (e.g resolution unit)
Rgds
 
#20 Posted : Tuesday, October 13, 2009 6:18:19 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

The resolution unit's data type is Short, and its length is one.
Possible values are:
2 = inch (CMNT_FOCALPLANEXRESOLUTION and CMNT_FOCALPLANEYRESOLUTION are expressed in dots per inch).

3 = cm (CMNT_FOCALPLANEXRESOLUTION and CMNT_FOCALPLANEYRESOLUTION are expressed in dots per cm).

A sample code:
L_UINT16 resUnitTag = 2; // inches
L_SetTag (0x128, TAG_SHORT, 1, &resUnitTag);
L_WriteFileTag(TEXT("motorola.tif"), (pSAVEFILEOPTION)NULL);

You can find this information in our Raster Imaging C DLL help file under the help topic "Exif File Comments".
You might also need to read about this in TIFF specification documents.
 
  • 2 Pages
  • 1
  • 2
  • >
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.344 seconds.