[GFL SDK v2.82][XMP] - How to read xmp data ?

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

Moderators: XnTriq, xnview

smillien
Posts: 2
Joined: Sat Jun 28, 2008 9:23 pm

[GFL SDK v2.82][XMP] - How to read xmp data ?

Post by smillien »

Hi,

I can show xmp data in xnview but I can't read this data with gflsdk...
where can I find some help to read xmp data in jpeg file ?

Help me !

--
Regards,
Stéphane.
smillien
Posts: 2
Joined: Sat Jun 28, 2008 9:23 pm

[SOLVED][GFL SDK v2.82][XMP] - How to read xmp data ?

Post by smillien »

I found the solution...

Example in C++:

Code: Select all

AnsiString TfExif::GetXmpFromStream (TMemoryStream *stream)
{
  AnsiString xmlPart;
  char *beginCapture = "<rdf:RDF";
  char *endCapture   = "</rdf>";
  int beginPos;
  int endPos;

  char *ptr, *maxPtr;
    for (
      ptr = (char*)stream->Memory, maxPtr = ptr + stream->Size;
      memcmp (ptr, beginCapture, 8) && ptr < maxPtr;
      ++ptr
    );

  if (ptr != maxPtr) {
    beginPos = ptr - (char*)stream->Memory;
    //Memo->Lines->Append ("beginPos= " + IntToStr (beginPos));

    for (; memcmp (ptr, endCapture, 10) && ptr < maxPtr; ++ptr);

    if (ptr != maxPtr) {
      endPos = ptr - (char*)stream->Memory;
      //Memo->Lines->Append ("endPos=   " + IntToStr (endPos));

      int xmlLength = endPos - beginPos + 10;
      xmlPart.SetLength (xmlLength);

      stream->Seek (beginPos, soFromBeginning);
      stream->Read (xmlPart.c_str (), xmlLength);
    }
  }
  return xmlPart;
}
thanks to Omar Shahine.

--
Stéphane.