ImageEn, unit iexBitmaps

TIOParams.Dict

TIOParams.Dict


Declaration

property Dict: TIEDictionary;


Description

Contains a dictionary of additional properties.

The key "XMP" will contain a sub-dictionary parsed from XMP info.


Demo

Demo  Demos\InputOutput\XMP\XMP.dpr


Examples

// Load an SVG at double size
ImageEnView1.IO.Params.Dict.Clear();
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Scale', 2 );
ImageEnView1.IO.LoadFromFile( 'D:\SVG\Lion.svg' );

// Load an SVG at size 2000x1000px
ImageEnView1.IO.Params.Dict.Clear();
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Width', 2000 );
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Height', 1000 );
ImageEnView1.IO.LoadFromFile( 'D:\SVG\Lion.svg' );

// Load an SVG at size 2000px wide. Auto-calculate height
ImageEnView1.IO.Params.Dict.Clear();
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Width', 2000 );
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Height', 0 );
ImageEnView1.IO.LoadFromFile( 'D:\SVG\Lion.svg' );

// Load an SVG at size 1000px high. Auto-calculate width
ImageEnView1.IO.Params.Dict.Clear();
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Width', 0 );
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Height', 1000 );
ImageEnView1.IO.LoadFromFile( 'D:\SVG\Lion.svg' );

// Load an SVG at size up to 2000x1000px, but maintain the Aspect ratio
ImageEnView1.IO.Params.Dict.Clear();
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Width', 2000 );
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Height', 1000 );
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:AspectRatio', 1 );
ImageEnView1.IO.LoadFromFile( 'D:\SVG\Lion.svg' );

// Load an SVG at 200 dpi
ImageEnView1.IO.Params.Dict.Clear();
ImageEnView1.IO.Params.Dict.Insert( 'ImageMagick:Density', 200 );
ImageEnView1.IO.LoadFromFile( 'D:\SVG\Lion.svg' );

// Rasterize page number 5 of mybook.pdf at 200dpi
ImageEnView1.IO.Params.ImageIndex := 5;
ImageEnView1.IO.Params.Dict.Insert('ImageMagick:Density', 200);
ImageEnView1.IO.LoadFromFile('mybook.pdf');

// gets XMP doc id
docid := ImageEnView1.IO.Params.Dict.GetString('xapMM:DocumentID', true);

// Output all entries of dc:subject->rdf:Bag of JPEG XMP
{
Example XMP content:

  <dc:subject>
    <rdf:Bag>
       <rdf:li>China</rdf:li>
       <rdf:li>Jan 2008</rdf:li>
       <rdf:li>Shanghai</rdf:li>
    </rdf:Bag>
  </dc:subject>

Output:

  China
  Jan 2008
  Shanghai
}
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_202112.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;