Example of implementation of Metadata Extractor - Extract IPTC information from jpg

Hi,
I want to extract (and later also edit) IPTC information from a .jpg file.

I found this:

It looks like exactly what I need :slight_smile: Except I don’t know how to use it as I’m quite new to UiPath.

I installed the package “MetadataExtractor” but I don’t see it in my installed activities.

Also I don’t know which Variable Type to assign (IEM Directory???

This is the example code from the site:

IEnumerable directories = ImageMetadataReader.ReadMetadata(imagePath);

Can somebody help me? :slight_smile: If somebody has a better plan to extract and edit IPTC information, that is also cool :slight_smile:

Thanks!

Hi,

Can you try the following sample?

Sample20230628-1.zip (97.7 KB)

Regards,

Thanks! It works!!

I have some questions for my understanding and learning purposes:

  • how did you know that metadatalist is this type and how did you select it in Studio?
<?xml version="1.0" encoding="utf-16"?>

How did you know that this would be the correct method:

CDynamic.MetaExtractor.ImageMetadataReader.ReadMetadata(targetFile)

The github page does not mention this piece of code.

and last question :slight_smile:
now it is an read only list - meaning I cannot edit the metadata. Do you know a way of editing this?
I want to edit the IPTC metadata (“keywords”) / add keywords.

Thanks again!!

Hi,

how did you know that metadatalist is this type and how did you select it in Studio?

We can know it from complementary function as the following.

Then choose IReadOnlyList
IReadOnlyList is standard .net class and we can easily choose it.
image

And we can easily estimate this Directory is from CDynamic.MetaExtractor

image

How did you know that this would be the correct method:

CDynamic.MetaExtractor.ImageMetadataReader.ReadMetadata(targetFile)

I used the above expression because you suggests in original post. (Just add Namespace)

now it is an read only list - meaning I cannot edit the metadata. Do you know a way of editing this?
I want to edit the IPTC metadata (“keywords”) / add keywords.

i think this package is just extractor (reader). So if you need to modify it, perhaps you need to use other library.

Regards,

1 Like

A newbee question:

  • how do you find the namespace to use? So how did you know to start with cdynamic and then metaextractor?

HI,

We can find CDynamics.MetaExtractro namespace if search by “ImageMetadataReader” as the following image

image

Regards,

thanks for helping! @Yoichi

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.