#include "ltwrappr.h"
L_INT LFile::ReadTags(uFlags, puTagCount, ppTags, puDataSize, ppData, pLoadOptions)
L_UINT uFlags; |
control flags |
L_UINT * puTagCount; |
number of tags found |
pLEADFILETAG * ppTags; |
address of the variable for tags data |
L_SIZE_T * puDataSize; |
the overall size of the tags data |
L_UCHAR ** ppData; |
the overall tags data |
pLOADFILEOPTION pLoadOptions; |
pointer to optional extended load options |
Gets all the tags stored in a file.
Parameter | Description | |
uFlags | Flag that determines whether to read the tag overall data. You can combine values when appropriate by using a bitwise OR ( | ): | |
Flag | Meaning | |
READFILEMETADATA_NOMEMORY | [0x01] Do not read the tag overall data. If this flag is set, then puDataSize and ppData will not be used and the function will not read the tag overall data. | |
puTagCount | Address of the variable to be updated with the number of tags found in the file. | |
ppTags | Pointer to an array of pLEADFILETAG structures. Each element of the array contains data for one tag found in the file. The number of elements in ppTags is puTagCount. When this array is no longer needed pass it to the LFile::FreeTags function to free the allocated memory. | |
puDataSize | Address of the variable to be updated with the size in bytes of the overall tags data. | |
ppData | Address of the variable to be updated with a pointer to the overall tags data. The size of this pointer in bytes is puDataSize. Each LEADFILETAG item found contains an offset to where the data for this item is stored in ppData. | |
pLoadOptions | Pointer to optional extended load options. Pass NULL to use the default load options. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
You must free the data allocated with this function using the LFile::FreeTags function.
For general information about TIFF tags, refer to Implementing TIFF Comments and Tags.
Required DLLs and Libraries
LTFIL For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
Functions: |
LFile::FreeTags, LFile::ReadComments, LFile::ReadGeoKeys, Class Members |
Topics: |
L_INT LFile__ReadFileTagsExample()
{
LFile LeadFile;
L_INT nRet;
L_UINT i = 0, uTagCount = 0, uCommentCount = 0, uGeoKeyCount = 0;
pLEADFILETAG pTags = NULL, pCurrentTag, pGeoKeys = NULL, pCurrentGeoKey;
L_SIZE_T uTagDataSize = 0, uCommentDataSize = 0, uGeoKeyDataSize = 0;
L_UCHAR *pTagData = NULL, *pCommentData = NULL, *pGeoKeyData = NULL;
L_CHAR *pszAscii = NULL;
pLEADFILECOMMENT pComments = NULL, pCurrentComment;
LeadFile.SetFileName(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\image1.jpg"));
// read all the tags from the file
nRet = LeadFile.ReadTags(0, &uTagCount, &pTags, &uTagDataSize, &pTagData, NULL);
// Read all the comments in the file
if(nRet == SUCCESS)
{
// Yes, read all the comments from the file
nRet = LeadFile.ReadComments(0, &uCommentCount, &pComments, &uCommentDataSize, &pCommentData, NULL);
}
// Read all the geo keys in the file
if(nRet == SUCCESS)
{
// Yes, read all the geo keys from the file
nRet = LeadFile.ReadGeoKeys(0, &uGeoKeyCount, &pGeoKeys, &uGeoKeyDataSize, &pGeoKeyData, NULL);
}
if(nRet == SUCCESS)
{
if(uTagCount > 0)
{
// Show the tags
wprintf(L"Tags\n");
for(i = 0; i < uTagCount; i++)
{
pCurrentTag = &pTags[i];
// If this tag is of type ASCII, get its data
if(pCurrentTag->uType == TAG_ASCII)
{
pszAscii = (L_CHAR*)malloc(pCurrentTag->uDataSize + 1);
ZeroMemory(pszAscii, pCurrentTag->uDataSize + 1);
CopyMemory(pszAscii, pTagData + pCurrentTag->uDataOffset, pCurrentTag->uDataSize);
}
else
{
pszAscii = NULL;
}
printf("Id: 0x%X, data length: %u, data: %s\n", pCurrentTag->uTag, pCurrentTag->uDataSize, pszAscii != NULL ? pszAscii : "Binary data");
}
LeadFile.FreeTags(uTagCount, pTags, uTagDataSize, pTagData);
}
if(uCommentCount > 0)
{
// Show the Comments
wprintf(L"Comments\n");
for(i = 0; i < uCommentCount; i++)
{
pCurrentComment = &pComments[i];
// If this comment is of type ASCII, get its data
printf("Id: 0x%X, data length: %u\n", pCurrentComment->uType, pCurrentComment->uDataSize);
}
LeadFile.FreeComments(uCommentCount, pComments, uCommentDataSize, pCommentData);
}
if(uGeoKeyCount > 0)
{
// Show the geo keys
wprintf(L"GeoKeys\n");
for(i = 0; i < uGeoKeyCount; i++)
{
pCurrentGeoKey = &pGeoKeys[i];
// If this geo key is of type ASCII, get its data
if(pCurrentGeoKey->uType == TAG_ASCII)
{
pszAscii = (L_CHAR*)malloc(pCurrentGeoKey->uDataSize + 1);
ZeroMemory(pszAscii, pCurrentGeoKey->uDataSize + 1);
CopyMemory(pszAscii, pGeoKeyData + pCurrentGeoKey->uDataOffset, pCurrentGeoKey->uDataSize);
}
else
{
pszAscii = NULL;
}
printf("Id: 0x%X, data length: %u, data: %s\n", pCurrentGeoKey->uTag, pCurrentGeoKey->uDataSize, pszAscii != NULL ? pszAscii : "Binary data");
}
LeadFile.FreeTags(uGeoKeyCount, pGeoKeys, uGeoKeyDataSize, pGeoKeyData);
}
}
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET