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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 XMP Subject contain list

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
dave.sellers Posted - Dec 17 2021 : 07:53:42
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
4   L A T E S T    R E P L I E S    (Newest First)
dave.sellers Posted - Dec 23 2021 : 05:33:26
Thanks Nigel, I'll have a play with that and discuss with the users how best to make use of it.

Cheers
Dave
xequte Posted - Dec 22 2021 : 20:31:00
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
dave.sellers Posted - Dec 20 2021 : 06:46:45
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
xequte Posted - Dec 18 2021 : 21:45:57
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