ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 XMP Subject contain list
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

dave.sellers

United Kingdom
17 Posts

Posted - Dec 17 2021 :  07:53:42  Show Profile  Reply
I'm adding support for XMP data in an existing application.

In the sample file (attached) there are multiple values for dc:subject within the XMP:


         <dc:subject>
            <rdf:Bag>
               <rdf:li>China</rdf:li>
               <rdf:li>Jan 1985</rdf:li>
               <rdf:li>QJ class</rdf:li>
            </rdf:Bag>
	</dc:subject>


TIOParamsHelper.XMP_WriteToStrings only writes out the 1st <rdf:li> item 'China' as the Subject. Similarly the TStringGridHelper methods.

Looking at some on-line XMP they showed 'China', 'Jan 1985' and 'QJ class' nested beneath Subject.

I can see this info in the IOPArams.XMP_Info but is it (or should it be) exposed via classes or methods somewhere?

Apologies if I'm missing something obvious and thanks in advance for any help

Thanks
Dave


attach/dave.sellers/2021121775013_J.-000.JPG

xequte

7086 Posts

Posted - Dec 18 2021 :  21:45:57  Show Profile  Reply
Hi Dave

I'll need to take a look at iexMetaHelpers and see if we can add support for multiple values.

XMP is available as a TIEDict object using:

xmp := ImageEnView1.IO.Params.Dict.GetDictionary('XMP');
sDescription := xmp.GetString('dc:description', True);

https://www.imageen.com/help/TIOParams.Dict.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

dave.sellers

United Kingdom
17 Posts

Posted - Dec 20 2021 :  06:46:45  Show Profile  Reply
Hi Nigel

Thanks for that but the dictionary seems similarly constrained.

xmp.GetString(XMP_DC_Subject, True) returns just 'China'.

ReadGridFromXMP calls _ReadFromXMP_Params which in turn uses IOParams.XMP_AsStr which ultimately uses Dict.GetDictionary( 'XMP' ).GetString( Field, True ) as above.

TIEDictionary.GetString uses its own Get method which in the case of a list of values like these three Subject entries could return a list of some sort but it gets a little beyond me at this point. GetList threw an invalid cast exception since internally it has another Dictionary, calling Get returns a TIEDictionary with count of 1

Regards
Dave
Go to Top of Page

xequte

7086 Posts

Posted - Dec 22 2021 :  20:31:00  Show Profile  Reply
Hi Dave

Yes, that should really be documented better. Here's an example for you.

{
Output all entries of dc:subject->rdf:Bag into "memo1"

Example XMP content:
       <dc:subject>
          <rdf:Bag>
             <rdf:li>China</rdf:li>
             <rdf:li>Jan 1985</rdf:li>
             <rdf:li>QJ class</rdf:li>
          </rdf:Bag>
       </dc:subject>
}
var
  xmpDict: TIEDictionary;  // Dict contailing image XMP data
  navDict: TIEDictionary;  // Dict to navigate XML structure
  list: TObjectList;
  i: integer;
begin
  ImageEnView1.IO.LoadFromFile( 'D:\XMP_Data_2021121775013_J.-000.JPG' );

  // Get XMP
  xmpDict := ImageEnView1.IO.Params.Dict.GetDictionary('XMP');

  // Output all entries of dc:subject->rdf:Bag into "memo1"
  navDict := xmpDict.GetDictionary('dc:subject', True);
  navDict := navDict.GetDictionary('#content', false);
  navDict := navDict.GetDictionary('rdf:Bag', false);
  navDict := navDict.GetDictionary('#content', false);
  list := navDict.GetList('rdf:li', false);
  for i := 0 to list.Count - 1 do
  begin
    navDict := TIEDictionary(list[i]).GetDictionary('#content', false);
    memo1.lines.add( navDict.GetString('#text', false) );
  end;
end;



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

dave.sellers

United Kingdom
17 Posts

Posted - Dec 23 2021 :  05:33:26  Show Profile  Reply
Thanks Nigel, I'll have a play with that and discuss with the users how best to make use of it.

Cheers
Dave
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: