ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: raldo on August 27, 2012, 05:53:31 PM

Title: Convert facetags from WLPG to Picasa
Post by: raldo on August 27, 2012, 05:53:31 PM
I've tagged a whole bunch of photos in WLPG and I'd like to convert the XMP to Picasa.

Any starting hints? Is it even possible
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 27, 2012, 06:34:44 PM
Where does Picasa store this information?  I fear that it may be in a .ini file, which would require a bit of Perl scripting to write.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: gcoupe on August 28, 2012, 09:59:46 AM
The latest version of Picasa (3.9) uses the proposed Face Region standard of the Metadata Working Group to store XMP metadata into JPEG files. It should also read in the Microsoft Person Tag (which includes Microsoft's face region data) from the metadata created by WLPG.

The trick is to force Picasa to then write out the Face Region data into the JPEG files. I think it can be done by selecting all the thumbnails of a given person under "People" then right click and choose "Move to New Person..." and reselect the same name. Clicking on "Choose" then seems to do the updating of the files and also adds the tags for all other people who have been recognised in the affected photos. See this post for more info: http://gcoupe.wordpress.com/2011/12/10/picasa-versus-windows-live-photo-gallery/

Of course, using ExifTool would be safer - Picasa 3.9 still has bugs, and will strip out Canon Makernotes... But I'll leave that to others more competent than I.
Title: Re: Convert facetags from WLPG to Picasa
Post by: raldo on August 28, 2012, 01:12:33 PM
In recent versions of Picasa, the info is stored in the file as XMP.

I have attached a test file with persons Test, Test2 tagged. I can see this in Geosetter and it seems as if persons are in a comma separated list (Region Name). The region parameters are similarly in comma separated lists.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 28, 2012, 01:16:40 PM
It sounds like the easiest solution is to use Picasa if this works.  Otherwise, it should be possible to do this with ExifTool, but would require a bit of effort to create the necessary user-defined tags.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: raldo on August 28, 2012, 01:27:25 PM
It is not possible to use Picasa (as far as I understand from the Picasa forums). At least in Picasa's current state. The reason is that Picasa sees the WLPG tags but additionally recognizes the same faces. So one has to manually remove all of Picasa's new selections.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 28, 2012, 01:47:01 PM
OK then, ExifTool it is.

If you post a (small) image with a couple of faces tagged by WLPG and the same image with the same faces tagged by Picasa I should be able to come up with a user-defined tag that will do this transformation for you.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: raldo on August 28, 2012, 02:13:46 PM
Quote from: Phil Harvey on August 28, 2012, 01:47:01 PM
OK then, ExifTool it is.
Yup.

I'll redo the image I posted previously in WLPG.
Title: Re: Convert facetags from WLPG to Picasa
Post by: raldo on August 28, 2012, 02:53:35 PM
I have attached an image where the same people are tagged in approximately the same area as they are tagged in the previously posted picasa image.

As far as I understand, the rectangle corners are in normalized coordinates wrt. width and height in both applications.

Thanks!
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 29, 2012, 06:51:05 AM
Thanks.  Give me a bit of time to work on this.  I'll try to have something within a day or so.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: raldo on August 29, 2012, 05:08:00 PM
Quote from: Phil Harvey on August 29, 2012, 06:51:05 AM
Thanks.  Give me a bit of time to work on this.  I'll try to have something within a day or so.

- Phil

Great!
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 30, 2012, 08:00:29 AM
OK, here you go.  Attached is the config file to do this conversion.  (See the sample config file (https://exiftool.org/config.html) for installation instructions.)

With this config file installed, the following command will translate WLPG regions to standard MWG:

exiftool "-regioninfo<myregion" FILE

(where FILE is one or more file and/or directory names)

Here is what the attached config file looks like:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        MyRegion => {
            Require => {
                0 => 'RegionInfoMP',
                1 => 'ImageWidth',
                2 => 'ImageHeight',
            },
            ValueConv => q{
                my ($rgn, @newRgns);
                foreach $rgn (@{$val[0]{Regions}}) {
                    my @rect = split /\s*,\s*/, $$rgn{Rectangle};
                    my %newRgn = (
                        Area => {
                            X => $rect[0] + $rect[2]/2,
                            Y => $rect[1] + $rect[3]/2,
                            W => $rect[2],
                            H => $rect[3],
                            Unit => 'normalized',
                        },
                        Name => $$rgn{PersonDisplayName},
                        Type => 'Face',
                    );
                    push @newRgns, \%newRgn;
                }
                return {
                    AppliedToDimensions => { W => $val[1], H => $val[2], Unit => 'pixel' },
                    RegionList => \@newRgns,
                };
            },
        },
    },
);
1;  #end


The code in this ValueConv is quite advanced because it deals with XMP structures, which are tricky.

Let me know how this goes.  It looks to me like the region coordinates use the same coordinate system, but they were just different enough to worry me a bit.  Hopefully this works.

- Phil

Edit:  I checked the Microsoft and MWG specifications, and the X/Y position is top/left for WLPG but center for MWG, so a coordinate transformation was necessary after all.  I have fixed the config file accordingly and attached the new version.

Edit2: Removed the -struct option from the command since it is unnecessary when copying tags (although you must use it when just extracting information if you want to see any of the structures).
Title: Re: Convert facetags from WLPG to Picasa
Post by: raldo on August 30, 2012, 05:13:17 PM
Thanks, I'll experiment with this over the weekend.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on December 27, 2012, 09:03:35 AM
Attached is a config file that defines another tag to do the reverse conversion.  Here are the commands to use with this config file:

1) Convert from MP WLPG regions to MWG regions:

exiftool -config ExifTool_config_convert_regions "-regioninfo<myregion" FILE

2) Convert from MWG to WLPG regions:

exiftool -config ExifTool_config_convert_regions "-regioninfomp<myregionmmp" FILE

You can avoid the -config option in these commands by activating this config file as the default configuration.  See the instructions in the sample config file (https://exiftool.org/config.html) for details.

In case people are interested, this is the definition of the new user-defined tag to convert from MWG to WLPG regions:

        MyRegionMP => {
            Require => 'RegionInfo',
            ValueConv => q{
                my ($rgn, @newRgns);
                foreach $rgn (@{$val[0]{RegionList}}) {
                    my @rect = @{$$rgn{Area}}{'X','Y','W','H'};
                    $rect[0] -= $rect[2]/2;
                    $rect[1] -= $rect[3]/2;
                    push @newRgns, {
                        PersonDisplayName => $$rgn{Name},
                        Rectangle => join(', ', @rect),
                    };
                }
                return { Regions => \@newRgns };
            },
        },


Note that this will only work for rectangular regions.  The MWG specification also allows circles and points, but these are not supported by the Microsoft MP region structure.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: SonnyJim66 on January 02, 2013, 05:54:19 PM
Thanks for providing this.  I downloaded the config file and renamed it to make it my default config.

Conversion from Windows Photo Gallery to MWG tags seems to work fine, but each time I try to convert a file with people tags created by Picasa, I get an error message:

Warning: No writable tags set from MWG.jpg

I used Picasa 3.9.0 (Build 136.09.0) on Windows 7 SP1 (64-bit) to tag the faces, and I'm using the following syntax to perform the update:

exiftool "-regioninfomp<myregionmmp" MWG.jpg

Any ideas what I might be doing wrong?

Thanks.
Title: Re: Convert facetags from WLPG to Picasa
Post by: StarGeek on January 02, 2013, 07:12:01 PM
Misspelling in Phil's example, it's MyRegionMP, not MyRegionmMP.  (caps not required, I just copy/pasted from the config file to make sure it was correct)

exiftool -config ExifTool_config_convert_regions "-regioninfomp<MyRegionMP" FILE
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on January 02, 2013, 07:17:16 PM
Thanks StarGeek, that would do it.

If you are still having problems after fixing this typo, send me a sample image with Picasa face tags (philharvey66 at gmail.com) and I should be able to sort it out.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: SonnyJim66 on January 02, 2013, 07:43:59 PM
Problem solved by the corrected Typo.

Many thanks.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Tom Cunningham on February 11, 2013, 11:26:03 PM
Quote from: Phil Harvey on December 27, 2012, 09:03:35 AM
Attached is a config file that defines another tag to do the reverse conversion.  Here are the commands to use with this config file:

1) Convert from MP WLPG regions to MWG regions:

exiftool -config ExifTool_config_convert_regions "-regioninfo<myregion" FILE

2) Convert from MWG to WLPG regions:

exiftool -config ExifTool_config_convert_regions "-regioninfomp<myregionmmp" FILE


Are these additive conversions, that is, if I convert MWG regions to WPG, will the MWG region data still be in the file?  I would like to have both types of face data in the file.  Or is that a bad idea?

Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on February 12, 2013, 07:10:19 AM
These commands do not erase the other type of face data.  The only problem with having 2 different types is that you should remember to update the other type if you change one of them.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: raldo on May 29, 2013, 05:25:16 PM
Thanks for the info in this thread!

The newest releases now have the possibility of saving imported WLPG to Picasa's format in the file.

So my remaining task is now how to remove all WLP related stuff after the conversion to Picasa.

The command "exiftool.exe -RegionInfoMP= *.jpg" seems to to remove all the wlpg stuff. Am I correct?

Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on May 29, 2013, 07:11:04 PM
Yes.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: prestonfaiks on September 23, 2013, 10:54:01 PM
Is there any way to leave a file alone if at already has data in the destination field?

For example, going from MWG to WLPG regions, if the WLPG regions already exist, skip the file.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on September 24, 2013, 07:16:13 AM
Yes.  Add this to the command:  -if "not $regioninfomp" -struct

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: zgregc on August 22, 2014, 11:23:18 AM
Hi Phil -

This works great, I have been trying to figure this out for months!

Is there a command to not create the _original version?  If I do a huge directory, the conversion creates 2x the number of photos.

Or a command to delete it after creation?

Thanks,
Greg
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 22, 2014, 11:55:02 AM
Hi Greg,

Add -overwrite_original to the command.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: lseara on November 06, 2014, 11:40:48 AM
Hi Phill,

When I use -r to process subdirectories, it returns the message.

"Warning: No writable tags set from xxx.jpg"

Do you know if I'm doing something wrong?

Thanks,

Leonel
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on November 06, 2014, 11:46:38 AM
Hi Leonel,

You will get this message if none of the source tags exist in the image.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on November 09, 2014, 12:47:20 PM
Hi Leonel,

I got your file, and it already contains MWG region information.  If you want to convert this to Microsoft Photo regions, this works for me (using the "config_files/convert_regions.config" file included in the full distribution):

> exiftool -config config_files/convert_regions.config "-regioninfomp<MyRegionMP" ist.JPG
    1 image files updated


- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newbie21 on November 09, 2014, 02:56:59 PM
Quote from: Phil Harvey on November 09, 2014, 12:47:20 PM
Hi Leonel,

I got your file, and it already contains MWG region information.  If you want to convert this to Microsoft Photo regions, this works for me (using the "config_files/convert_regions.config" file included in the full distribution):

> exiftool -config config_files/convert_regions.config "-regioninfomp<MyRegionMP" ist.JPG
    1 image files updated


- Phil

Hello Phil,
the mail you got wasn't from Leonel but from me.
Sorry.

But your hint works for me (but the typo is still wrong in the file). I don't know why, because I used your script in this thread, but it works.

Thank U
Title: Re: Convert facetags from WLPG to Picasa
Post by: dawson on June 01, 2015, 07:10:25 PM
Hi.
Today I tried the following command:

exiftool -config ExifTool_config_convert_regions -r -overwrite_original "-regioninfomp<myregionmp" "D:\Lightroom6_Katalog\2015\2015-05-28"


On jpg-files, it worked well. Thanks for that.
But on my dng, it doesnt work.

What I have done:
- imported CR2 as DNG in Lightroom 6
- tagged a face/person in the DNG-file
- run the exiftool-command
- looked at the DNG with my Synology PhotoStation (newest version)
- there are no regions recognized, but they are there - I can see them with exiftool
- when face-tagging with PhotoStation (which uses xmp-mp, as far as I know), the Lightroom-XMP-MP-regions are overwritten.
- when I use exiftool then, to overwrite these tags again, PhotoStation doesnt recognize there own regions.

Could you tell me, what went wrong?
With exiftool, I can see the correct xmp-mp - contents.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on June 01, 2015, 08:08:05 PM
This may require a bit of detective work, a few iterations, and some help from you to determine the problem.

Could you post both the XMP for which PhotoStation doesn't recognize the faces, then the XMP from the same file after tagging with PhotoStation?  I am assuming that PhotoStation will recognize the faces that it just wrote?

Extract the XMP at each stage with a command like this:

exiftool -xmp -b test.dng > out.xmp

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: dawson on June 02, 2015, 09:26:05 AM
Hello,
so here are the xmp-files you asked for a few hours ago.

out_01.xmp
   before Import in Lightroom (but I have to say, that the dng was in lightroom 5.7 before - so this is a re-import in lightroom 6)

out_02.xmp
   after the (re-)import in Lightroom 6
   
out_03.xmp
   after tagging with lr6 (title, face and so on)

out_04.xmp
   after the exiftool-command

Command:
exiftool -config ExifTool_config_convert_regions -r -overwrite_original "-regioninfomp<myregionmp" "D:\Lightroom6_Katalog\2015\2015-05-28\IMG_7872.dng"
    1 image files updated


When I´m at home, I do some xmp-files after tagging the same dng with PhotoStation.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on June 02, 2015, 09:53:39 AM
OK, thanks.  I'm assuming that PhotoStation doesn't recognize the faces from any of these?

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: dawson on June 02, 2015, 10:21:20 AM
When I´m home - I will check.

Right now I have checked Windows Live Fotogalerie.
It doesnt recognize the xmp-mp - Regions or Names. It displays the changend "title"-Tag correctly, but not the face/person-tags.
When I´m face-tagging with Windows Live Fotogaliere - the tags arent saved to the file. Guess by editing dng-files the software only stores the tags in the database.
Title: Re: Convert facetags from WLPG to Picasa
Post by: dawson on June 02, 2015, 04:22:04 PM
So. Now I´ve checked PhotoStation.
I copied the file to my PhotoStation-Folder and opened it with PhotoStation.
No region and no face-tag where recognized.

Then I tagged the face on the picture with PhotoStation.
Here is the xmp after this tagging.
I tagged the face with "Max Mustermann" with Lightroom and with "MaxPS MustermannPS" with PhotoStation.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on June 02, 2015, 05:10:57 PM
Thanks for the sample.  I've taken an initial look, and there are structural differences in the XMP, but if these are the source of the problem then it could be difficult to solve.

Here is the ExifTool XMP that seems not to work in PhotoStation:

  <MP:RegionInfo rdf:parseType='Resource'>
   <MPRI:Regions>
    <rdf:Bag>
     <rdf:li rdf:parseType='Resource'>
      <MPReg:PersonDisplayName>Max Mustermann</MPReg:PersonDisplayName>
      <MPReg:Rectangle>0.59561, 0.24027, 0.29886, 0.44808</MPReg:Rectangle>
     </rdf:li>
    </rdf:Bag>
   </MPRI:Regions>
  </MP:RegionInfo>


Here is the PhotoStation XMP:

   <MP:RegionInfo rdf:parseType="Resource">
    <MPRI:Regions>
     <rdf:Bag>
      <rdf:li
       MPReg:Rectangle="0.227064, 0.042813, 0.516055, 0.428135"
       MPReg:PersonDisplayName="MaxPS MustermannPS"/>
     </rdf:Bag>
    </MPRI:Regions>
   </MP:RegionInfo>


You can see that PhotoStation used XMP shortcut notation for the region structure, while ExifTool used a parseType Resource, which is certainly legal.  Here is what Microsoft does, btw:

<MP:RegionInfo>
<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <MPRI:Regions xmlns:MPRI="http://ns.microsoft.com/photo/1.2/t/RegionInfo#">
   <rdf:Bag xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:li>
     <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <MPReg:Rectangle xmlns:MPReg="http://ns.microsoft.com/photo/1.2/t/Region#">0.510638, 0.146341, 0.125532, 0.205575
      </MPReg:Rectangle>
      <MPReg:PersonDisplayName xmlns:MPReg="http://ns.microsoft.com/photo/1.2/t/Region#">Barack Obama
      </MPReg:PersonDisplayName>
     </rdf:Description>
    </rdf:li>
   </rdf:Bag>
  </MPRI:Regions>
</rdf:Description>
</MP:RegionInfo>


Which uses the longhand version of putting the structure inside an rdf:Description.  The parseType Resource syntax allows this extra rdfDescription to be omitted.

Anyway.  At first glance I can't see the problem.  I will look at this in more detail as soon as I get a chance, and make some suggestions as to how to proceed, but this may be a couple of days because I am really busy at the moment.

- Phil

Edit:  Aside: These files have an XMP mwg-rs Rotation tag that is not part of the MWG specification, but is apparently added by Lightroom 6.  Maybe I should add support for this.  Interesting, but not related to the problem.

Edit2:  Try putting the attached XMP back into the file (exiftool "-xmp<=in_00.xmp" FILE) and tell me if PhotoStation recognizes this.  In this test I took the XMP that worked and changed nothing but the formatting of the RegionInfo structure.
Title: Re: Convert facetags from WLPG to Picasa
Post by: dawson on June 03, 2015, 06:25:09 PM
While testing your "in.xmp" I found out, that the problem might be PhotoStation itself.
I tagged a person with PhotoStation. Removed the pic von PhotoStation and moved it in again.
Guess what... PhotoStation doesn´t recognize the person anymore.

Do you have a Synology with newest DSM?
Can you (or any other reader) verfiy this "bug/feature"?

Btw: the option "face recognition" in settings of PhotoStation isn´t set. But however I can tag a person.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on June 04, 2015, 07:24:44 AM
I was leaning towards this being a PhotoStation quirk.  Perhaps it would be a good idea to check with them on this.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: dawson on June 06, 2015, 03:44:10 PM
It took a while - but now I reactivated my old DS410 and installed the newest DSM with PhotoStation.
I activated face recognition on the Synology. I copied 5 dngs in PhotoStation. It took over 1 min. for a single DNG-File.
The PhotoStation didn´t recognize the already tagged persons (both versions in xmp).
It didn´t even recognized the persons tagged by PhotoStation itself.
So ... totally beta and therefore useless - at least for my workflow.

Thanks for all your help. Exiftool is absolutely great, I will use it maybe later to convert all Lightroom-Tags into PhotoStation-Tags, when Synology finally fixed it.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on August 16, 2015, 05:15:52 PM
Many thanks for the miracle of the program!I take the first steps to ExifTool. Please help, how to register the command line using ExifToolGUI?
(http://img.maryno.net/preview/9e8c51359ce1e0163683b8ec103e4eb2/4252690dd0fb7375006fc0406af5b227.gif) (http://img.maryno.net/images/9e8c51359ce1e0163683b8ec103e4eb2/4252690dd0fb7375006fc0406af5b227.png)

(http://img.maryno.net/preview/9e8c51359ce1e0163683b8ec103e4eb2/ff859b02a39433586342677a6cba20a3.gif) (http://img.maryno.net/images/9e8c51359ce1e0163683b8ec103e4eb2/ff859b02a39433586342677a6cba20a3.png)
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 16, 2015, 09:35:40 PM
I think the problem is that you don't enter "exiftool" in the ExifTool Direct box.  This should start with "-config ...", not "exiftool -config ...".

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on August 17, 2015, 02:02:39 AM
I tried that. All the same error. Truth is another.
(http://img.maryno.net/preview/d12e4dfc9dae634004ab634dc5aade54/0a6ad4c5204c385fa6b372bd2d0061a3.gif) (http://img.maryno.net/images/d12e4dfc9dae634004ab634dc5aade54/0a6ad4c5204c385fa6b372bd2d0061a3.png)
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 17, 2015, 07:23:31 AM
Bad luck then.  I should have guessed that ExifToolGUI inserts argments before the ones in the box.  So it seems that the -config option can't be used with ExifToolGUI.  You'll need to do this from the command line.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on August 17, 2015, 03:20:00 PM
Very, very sorry. Thank you very much for your answers, Phil.
Title: Re: Convert facetags from WLPG to Picasa
Post by: StarGeek on August 17, 2015, 03:38:46 PM
Couldn't the config file be merged into the standard config file?  Or just backup the standard config file and rename the convert regions file to the standard file temporarily? 

The first would be more permanent, but a bit more difficult for someone who hasn't edited config files.  The second would be quick and easy.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 17, 2015, 03:40:33 PM
Ah.  Smart.  Rename the config file to .ExifTool_config and put it in the proper directory and it will be loaded automatically!  No -config option necessary.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on August 22, 2015, 03:42:02 AM
I try to add fulfillment of conversion into Ligntroom 6.1.1 with Jeffrey's "Run Any Command" Lightroom Export Plugin

(http://img.maryno.net/images/8965d1799c2e1687882b9ce68ddccd9e/cc205c32f59fe23a7eb63dee19837baf.png)

and again a failure:

Quote"c:\ExifToolGUI\exiftool.exe -config ExifTool_config_convert_regions "-regioninfomp<myregionmmp" -overwrite_original -m "D:\My documents\Desktop\2014-12-29 11-43-11.jpg""

run-any-command#81 +4161.6: [221BC968] @InitPlugin line 1033: Running: "c:\ExifToolGUI\exiftool.exe -config ExifTool_config_convert_regions "-regioninfomp<myregionmmp" -overwrite_original -m "D:\My documents\Desktop\2014-12-29 11-43-11.jpg" 1> "C:\Users\Admin\AppData\Local\Temp\LR-21" 2>&1"

run-any-command#81 +4161.9: [221BC968] @InitPlugin line 1037: STATUS is 0
Execute log:
--------------------------------------------------
> Warning: No writable tags set from D:/My documents/Desktop/2014-12-29 11-43-11.jpg
>     0 image files updated
>     1 image files unchanged
--------------------------------------------------

I have a bug in the code or Ligntroom can not perform this task?
If there is no error in the code, then it may be worth asking Jeffrey?
Title: Re: Convert facetags from WLPG to Picasa
Post by: StarGeek on August 22, 2015, 03:25:07 PM
Quote from: Newsky on August 22, 2015, 03:42:02 AM
"c:\ExifToolGUI\exiftool.exe -config ExifTool_config_convert_regions "-regioninfomp<myregionmmp" -overwrite_original -m "D:\My documents\Desktop\2014-12-29 11-43-11.jpg""

Your tag name is incorrect.  Try "-regioninfomp<MyRegionMP"
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on August 23, 2015, 01:27:07 AM
StarGeek, thank!I corrected the text, but did not help ...
Quote"c:\ExifToolGUI\exiftool.exe -config ExifTool_config_convert_regions "-regioninfomp<MyRegionMP" "M:\flickr\2014-12-29 11-43-11.jpg""

run-any-command#81 +425.3: [1B085BF8] @InitPlugin line 1033: Running: "c:\ExifToolGUI\exiftool.exe -config ExifTool_config_convert_regions "-regioninfomp<MyRegionMP" "M:\flickr\2014-12-29 11-43-11.jpg" 1> "C:\Users\Admin\AppData\Local\Temp\LR-25" 2>&1"

run-any-command#81 +425.7: [1B085BF8] @InitPlugin line 1037: STATUS is 0
Execute log:
--------------------------------------------------
> Config file not found
> Warning: No writable tags set from M:/flickr/2014-12-29 11-43-11.jpg
>     0 image files updated
>     1 image files unchanged
--------------------------------------------------
ExifTool_config_convert_regions lies near exiftool.exe
Title: Re: Convert facetags from WLPG to Picasa
Post by: ryerman on August 23, 2015, 09:45:00 AM
Try specifying the full path for the config file.
http://www.exiftool.org/exiftool_pod.html#advanced_options (http://www.exiftool.org/exiftool_pod.html#advanced_options)
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on August 24, 2015, 07:16:28 AM
ryerman, unfortunately, I couldn't understand as syntax of a full way and as it is correct to write it looks. You couldn't help me with it?
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 24, 2015, 08:27:13 AM
Here is how to specify a path for the config file on the command line

c:\ExifToolGUI\exiftool.exe -config c:\ExifToolGUI\ExifTool_config_convert_regions "-regioninfomp<MyRegionMP" "M:\flickr\2014-12-29 11-43-11.jpg"

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on August 24, 2015, 04:40:33 PM
Thank you, Phil! Everything works fine! And now I know what it looks like the syntax for using the configuration file.
Title: Re: Convert facetags from WLPG to Picasa
Post by: sgfrick on August 27, 2015, 06:01:02 AM
Hi, I have been using Windows Photo Gallery and facetagged thousands of photos.  I want to move everything to the new Google Photos service. I wasn't sure if using this method to make the facetags compatible with Picasa would work for Google Photos.  I am not very technical, but I downloaded exiftool and did use the cmd.exe to run the following command:

exiftool.exe -config ExifTool_config_convert_regions "-regioninfo<myregion" "foldername"

Using the config file found in this link: http://www.mysysadmintips.com/-downloads-/Windows/Home%20and%20Media/ExifTool_config_convert_regions

The command took quite a while and appeared to work with my 16K photos.  However, when I moved a sample of them over to Google Photos, I couldn't find any facetags.

I'm wondering if this method doesn't work for Google Photos? Or am I not doing it correctly (quite possible!)

I appreciate any help or advice.

Thanks,
Sean
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 27, 2015, 08:12:29 AM
Hi Sean,

It is difficult for me to help here because I don't use Google face tags, but I suggest you run "exiftool -a -G1" on a file that contains proper face tags and compare this with one of your converted files to see if the face information is stored in the same location.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: sgfrick on August 27, 2015, 01:01:09 PM
Thank you for your response, Phil. To show my ignorance, I'm not sure how to run "exiftool -a -G1".  Would I type this in the CMD screen?  Would it be:

exiftool -a -G1 -config ExifTool_config_convert_regions "-regioninfo<myregion" "foldername"

I downloaded the Windows exiftool.  Would I need to download anything else to run this command?

Thank you again for your help.

Sean
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on August 27, 2015, 01:09:42 PM
Hi Sean,

Yes, you do type it in a cmd.exe window, but here is the command:

exiftool -a -G1 FILE

where FILE is the name of a file.

See if you can find the differences in the face information of this output between files which do and don't work with google.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: sgfrick on August 28, 2015, 04:50:49 PM
Thank you.  I gave it a try, but now that I look into it more, it looks like Google Photos doesn't allow any type of tagging (other than adding photos to an Album).  So while it has face recognition, and shows photos that it believes are of the same person, it doesn't allow you to assign a name to that person.  Maybe they'll improve the service later. For now I'll stick with Windows Photo Gallery.
Title: Re: Convert facetags from WLPG to Picasa
Post by: EFortune on October 03, 2015, 12:54:23 PM

I have many tagged photos in WLG and am looking to bootstrap into Lightroom, so this script is a lifesaver.  Thank you!!

It's working perfectly for all of my landscape images, but the rectangles are all ending up in the wrong spot for all of the portrait images I've looked at.   Eyeballing it, it looks like the rectangles are rotated 180 degrees from the image.

Is my camera (7D Mk II) doing something odd? Is it possible that that the script needs to apply an additional transformation in my case for some reason?

I've attached the metadata from three versions of the image:
- "original" is the image with only the WPG data
- "script" is the result of processing with exiftool
- "lr" is the result of opening the "script" image with Lightroom and manually adjusting the rectangle to be in the right place.

Any tips appreciated.  My perl is rusty but I can take a swing at tweaking the script given a pointer in the right direction.

Thanks!
Title: Re: Convert facetags from WLPG to Picasa
Post by: EFortune on October 03, 2015, 01:09:04 PM
Indeed, taking a closer look at the "lr" metadata I notice that Lightroom added "Region Rotation -1.57080", which looks suspiciously like 180 degree rotation.  X & Y appear to also be transformed, though.

This image is rotated 90 CW.  If this theory is correct than images rotated the other way would presumably look right.  I rarely shoot that way and don't have any such images in my lightroom test folder, but I'm about to go shooting and I'll make a point of getting some portrait images in both directions so I have something to compare directly.

Cheers,
     Erik
Title: Re: Convert facetags from WLPG to Picasa
Post by: StarGeek on October 03, 2015, 03:27:38 PM
As I recall it, the Microsoft region specs don't take orientation into account.

I created a config file that will allow you to rotate regions.  You can grab it from this post (https://exiftool.org/forum/index.php/topic,6354.msg32394.html#msg32394).   Your command would be something along the lines of:
exiftool -config Rotate_Regions.config -if "$Orientation eq 'Rotate 180 CW'" -RegionInfoMP<RotateMPRegionCW180" FILEorDIR


Title: Re: Convert facetags from WLPG to Picasa
Post by: EFortune on October 04, 2015, 02:38:34 AM
I went and hacked the convert_regions config to rotate the regions 180 degrees for any image with orientation 90 CW or 270 CW (attached).  It's fairly ugly but it seems to be reliably pushing face tags in both directions, which is good enough for me, for now.

Thanks for all of your help!
Title: Re: Convert facetags from WLPG to Picasa
Post by: milchtaich on October 04, 2015, 03:57:48 PM
Quote from: EFortune on October 03, 2015, 01:09:04 PM
Indeed, taking a closer look at the "lr" metadata I notice that Lightroom added "Region Rotation -1.57080", which looks suspiciously like 180 degree rotation.  X & Y appear to also be transformed, though.

This may have to do with the problem I described (https://exiftool.org/forum/index.php/topic,6354.msg32157.html#msg32157 (https://exiftool.org/forum/index.php/topic,6354.msg32157.html#msg32157)) with Microsoft's mis-implementation of their own standard. Specifically, they seem to write the x and y coordinates in the wrong order with respect to the published standard, and similarly for H and W.

By the way, 1.57 radians is 90°, not 180°. Lightroom's Region attribute describes the rotation of the face relative to the unrotated image. When the application reads the face information rather than identifying it itself, the value of the attribute simply reflects the Exif orientation tag. So this number doesn't have much to do with the problem you identified.
Title: Re: Convert facetags from WLPG to Picasa
Post by: EFortune on October 04, 2015, 11:20:27 PM
You're right of course.  I should know better than to attempt a coherent post at 3 in the morning:)

For whatever reason, it appears that all of the images identified as portrait (either 90 or 270) had regions that were 180 degrees out of phase.  Rotating the regions in just those images seems to have worked for the 20k or so images I've tried so far.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Leonardozep on February 16, 2016, 04:50:23 PM
WOW, I tried to convert the tags from Picasa to Windows Live Photo Gallery and... it works!!! Thank you very much! I will be always grateful to you for this jewel!
Title: Re: Convert facetags from WLPG to Picasa
Post by: Leonardozep on February 16, 2016, 05:05:09 PM
PS: is there a way to "batch convert" the regions? As I have 1.476 folders it would be great to do something like Pictures folder\*.jpg . I've tried but the *.jpg work only inside the folder and not through subfolders. Thanks anyway, this program and this script is really a JEWEL!
Title: Re: Convert facetags from WLPG to Picasa
Post by: StarGeek on February 16, 2016, 05:58:31 PM
Use the -ext option instead of *.jpg, add -r to recurse into subfolders.  -ext jpg -r path/to/TopLevelFolder
Title: Re: Convert facetags from WLPG to Picasa
Post by: Leonardozep on February 16, 2016, 06:00:09 PM
Quote from: StarGeek on February 16, 2016, 05:58:31 PM
Use the -ext option instead of *.jpg, add -r to recurse into subfolders.  -ext jpg -r path/to/TopLevelFolder

Thanks! Will try!
Title: Re: Convert facetags from WLPG to Picasa
Post by: Leonardozep on February 16, 2016, 06:05:12 PM
It works!!! Thank you, you are great!
Title: Re: Convert facetags from WLPG to Picasa
Post by: andorp on June 13, 2016, 06:21:28 PM
Hello,

I really appreciate your work. I can see that you helped to a lot of people. Last week moved from windows to mac and from Photo Gallery to  Lightroom and observed that face tags were not imported.

I came across your tool when I was looking for a solution for my problem:Today I tried the following command on a test-folder, which I knew to contain face tags:

exiftool -config ExifTool_config_convert_regions "-regioninfo<myregion" /Users/myname/Downloads/2013_12_01 -m -r -overwrite_original

Unfortunately, this is the result I have got:

"Config file not found
Warning: No writable tags set from /Users/Pivarcsi/Downloads/2013_12_01/_DSC3456.JPG
...
1 directories scanned
    0 image files updated
   72 image files unchanged"

I am not an expert and I do not know whether this could be the problem, but a user with  a similar problem has been suggested (by ryerman) to specify the full path for the config file and Phil was kind enough to specify it to the user who asked about this (c:\ExifToolGUI\exiftool.exe -config c:\ExifToolGUI\ExifTool_config_convert_regions), which solved the problem.

I am sorry but I do not know what the equivalent solution for mac OS is.

Thank you for your help in advance.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on June 13, 2016, 10:01:53 PM
Instead of typing "ExifTool_config_convert_regions", drag and drop that config file on the cmd.exe window.  This will automatically enter the full path for you so that exiftool can find it.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: andorp on June 14, 2016, 05:10:35 PM
Worked wonderfully. Thank you! Your tool is fantastic!

I have tagged all of my photos carefully and feared that I did it in vain.

I have received a few error messages, about which I don't know whether I should worry about (see below). Probably not so much, since the face tags were where they were supposed to be after importing the test-photos into Lightroom. And this is what counts for me most.

Use of uninitialized value in transliteration (tr///) at /usr/local/bin/lib/Image/ExifTool/WriteXMP.pl line 170.
Use of uninitialized value in scalar assignment at /usr/local/bin/lib/Image/ExifTool/XMP.pm line 2566.
Use of uninitialized value in pattern match (m//) at /usr/local/bin/lib/Image/ExifTool/XMP.pm line 2568.
Use of uninitialized value $str in substitution (s///) at /usr/local/bin/lib/Image/ExifTool/XMP.pm line 2450, <EXIFTOOL_FILE2> chunk 16.
Use of uninitialized value in addition (+) at /usr/local/bin/lib/Image/ExifTool/WriteXMP.pl line 1159, <EXIFTOOL_FILE2> chunk 16.
Use of uninitialized value $val in string eq at /usr/local/bin/lib/Image/ExifTool/WriteXMP.pl line 1269, <EXIFTOOL_FILE2> chunk 16.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on June 15, 2016, 07:58:38 AM
Can you possibly send me a sample image which gave these warnings?  I would like to track this down.  My email is philharvey66 at gmail.com

Thanks

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: andorp on June 15, 2016, 06:05:02 PM
An invitation has been sent to your e-mail via dropbox.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on June 16, 2016, 08:20:30 AM
Thanks.  I got the files and was able to reproduce the warning.

The warning occurs when an input MP region is missing the PersonDisplayName field.  In this case, the output region Name is getting set to an undefined value, a warning is issued, and the output structure has an empty Name field.  This could be fixed in either the config file, or ExifTool, or both.  For now I will patch ExifTool to test for undefined structure fields and simply not add them in this case.  The difference will be that there will be no Name field at all in the output structure.

So what you have done should be fine, but in future ExifTool will avoid writing empty fields for values that don't exist.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: neebah on August 25, 2016, 12:22:50 AM
This doesn't seem to work for tif files.  Does the config file need modification to do so.  I'm going from MWG to WLPG I"m getting the Warning:  No writable tags set from test.tif
Title: Re: Convert facetags from WLPG to Picasa
Post by: StarGeek on August 25, 2016, 01:54:11 AM
Quote from: neebah on August 25, 2016, 12:22:50 AM
Warning:  No writable tags set from test.tif

There's no reason that it wouldn't work on a tif file.  The warning you're getting says there isn't a region to copy in your file.  What is the command you are using and what is the output of this command:
exiftool -g1 -a -s -XMP-mwg-rs:all -XMP-MP:all TifFile
Title: Re: Convert facetags from WLPG to Picasa
Post by: neebah on August 25, 2016, 07:07:57 AM
exiftool -config ExifTool_config_convert_regions "-regioninfomp<myregionmmp" FILE   

is the command that I'm using. 
Title: Re: Convert facetags from WLPG to Picasa
Post by: rubpa on August 29, 2016, 05:40:45 AM
Hello!

With Picasa killed, I'm looking for alternatives with similar or better workflow for tagging & face tagging photos. This excellent thread gave me the required detail on the differences between WPG, Picasa, LR, etc.

Question (sorry, it's not exactly related to exiftool): what is the recommended lightweight tool (like IrfanView) to view face tags and regions? I want to see all marked rectangles and the names while viewing the photo.
Title: Re: Convert facetags from WLPG to Picasa
Post by: StarGeek on August 29, 2016, 11:41:02 AM
Quote from: rubpa on August 29, 2016, 05:40:45 AM
Question (sorry, it's not exactly related to exiftool): what is the recommended lightweight tool (like IrfanView) to view face tags and regions? I want to see all marked rectangles and the names while viewing the photo.

I have yet to find one on Windows.  I know some paid photo management programs have it.  Lightroom 6 and IMatch 5, I believe have it.  But nothing for free that I can find.
Title: Re: Convert facetags from WLPG to Picasa
Post by: José Oliver-Didier on February 12, 2017, 08:08:07 PM
I am trying out the WLPG to MWG Regions config and works great! However I have a question pertaining to WGP People Tags with do not contain any regions. WPG allows the user to tag a photo with a People Tag without specifying a region. Thus, a photo with such a case, upon conversion using Phil's config I get:

     <rdf:li rdf:parseType='Resource'>
      <mwg-rs:Area rdf:parseType='Resource'>
       <stArea:unit>normalized</stArea:unit>
       <stArea:x>0</stArea:x>
       <stArea:y>0</stArea:y>
      </mwg-rs:Area>
      <mwg-rs:Name>Person Name</mwg-rs:Name>
      <mwg-rs:Type>Face</mwg-rs:Type>
     </rdf:li>

With the stArea and stArea values at zero.

I do not mind that, but I was wondering how other applications such a Lightroom, Photo Supreme or IMatch 5 handle such a case or if they support this scenario?

Thanks.
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on February 13, 2017, 08:09:27 AM
Hi José,

Good question.   I don't have an answer to this, but it would probably be best not to write 0,0.  I'll change it for now to just not write the Area element if the WLPG region doesn't contain a Rectangle, but if this causes problems for some software then it may be best to ignore these regions entirely.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: José Oliver-Didier on February 13, 2017, 10:41:09 AM
Thanks Phill! Maintaining the region name makes sense from an information preservation standpoint when converting from one format to another.
Title: Re: Convert facetags from WLPG to Picasa
Post by: José Oliver-Didier on February 17, 2017, 04:51:31 AM
Question - Where can one download the updated ExifTool_config_convert_regions?
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on February 17, 2017, 08:02:03 AM
It is in the full Image-ExifTool (.tar.gz) distribution.  Also, you can find the latest version here at SourceForge (https://sourceforge.net/p/exiftool/code/ci/master/tree/config_files/convert_regions.config).

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on February 24, 2017, 06:47:57 AM
Unfortunately we do not speak English and can not explain the problem. I wrote down the essence of the problem in the video, I hope you can understand and maybe I can help get rid of this problem. Thank you!
https://youtu.be/_ut7DZ9-Cvo
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on February 24, 2017, 07:27:06 AM
I think this is a problem with Geosetter, but attach the image that shows this problem and I will take a look.

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on February 24, 2017, 07:45:50 AM
https://www.dropbox.com/s/ygvxhosf2ujqbgk/ExifTool_config_convert_regions_problem.zip?dl=0
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on February 24, 2017, 08:17:58 AM
I downloaded the most recent version of Geosetter and I don't see this problem (although the tooltip font doesn't seem to support these characters).  Also, using ExifTool I don't see any problems with the metadata.

I suggest trying the most recent version of Geosetter, and if that doesn't work then send the problem image to the Geosetter developers.

(https://exiftool.org/forum/index.php?action=dlattach;topic=4361.0;attach=2001)

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Newsky on February 24, 2017, 08:50:57 AM
(http://img.maryno.net/images/9be1e0e35c6c8a3cffe10c4810fddd30/bb910b0d0ec511995f6c9d6f81f42f66.png)

(http://img.maryno.net/images/9938213f55ffa7ee0a392ea7bbf2b246/56fe46d4dad42ee11927ea412d902e52.png)

Problem file:
(http://img.maryno.net/images/2ee937d0caeeeb12ffae5d8282654f30/47ca38de182fc148ff3d194608c1720b.png)

No Problem (after "Save metadate to file" in LR):
(http://img.maryno.net/images/148ec1c03099ef86fc6c48adedbba148/beaafd19d3c04bf420ce8bd5221e0b39.png)
Title: Re: Convert facetags from WLPG to Picasa
Post by: msitekkie on July 28, 2017, 08:32:32 AM
Quote from: Phil Harvey on November 06, 2014, 11:46:38 AM
Hi Leonel,

You will get this message if none of the source tags exist in the image.

- Phil

Hi Phil,

many thanks for all your hard work on this, (stepping in when the big guys leave us high & dry!) looks like just what I need :). I know Picasa has been deprecated by Google and WLPG by Microsoft, but Windows 10 Explorer seems to understand the people tags used by WLPG so I'm trying to convert Picasa Face tags to WLPG tags.

I used the command: >exiftool.exe -config ExifTool_config_convert_regions "-regioninfomp<MyRegionMP" "D:\Myfolder"
and also get the message "No writeable tags set from D:\Myfolder"

I checked beforehand that the face tagging info is present in Picasa and I also downloaded the latest convert_regions file from SourceForge.
I tried two other folders with the same results apart from a single file (which wasn't obviously different) which worked"
Any thoughts?

Robin
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on July 28, 2017, 08:47:33 AM
Hi Robin,

The MyRegionMP tag converts the MWG RegionInfo.  Perhaps this doesn't exist in your image.

What is the output of this command for one of your files?:

exiftool -struct -G1 -s "-*region*" D:\Myfolder\somefile

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: msitekkie on July 28, 2017, 09:04:18 AM
I think I have resolved this myself. Although I went through a conversion process some time back to convert my photos from using the original/default Picasa method of storing the face tag information (where I believe the face tagging was/is stored in a database), to storing it in the file, when I use exiftool -a -G1 filename it looks like this hasn't taken and I need to use to use the "Tools, Experimental, Write Faces to XMP" option in Picasa.
I had "Store name tags in photo" set in options so appears to be OK for more recent photos.

Hopefully this information will be of use to others anyway.
Title: Re: Convert facetags from WLPG to Picasa
Post by: CoolSwoosh on October 12, 2017, 08:58:53 PM
Phil, I tried the below command (to skip any files that have MWG tags) and it does not seem to work for me, or I am using it in the wrong place. It is going through the folder but saying that most files failed the condition. Here is my full command:


Z:\exiftool.exe -config z:\convert_regions.config "-regioninfo<myregion" -ext jpg -r "z:\personal\pictures\2002\July 2002\" -if "not $regioninfomp" -struct -overwrite_original


Quote from: Phil Harvey on September 24, 2013, 07:16:13 AM
Yes.  Add this to the command:  -if "not $regioninfomp" -struct

- Phil
Title: Re: Convert facetags from WLPG to Picasa
Post by: Phil Harvey on October 13, 2017, 08:35:18 AM
MyRegion is derived from RegionInfoMP, so if RegionInfoMP doesn't exist then your command won't do anything.  So your command won't do anything for the files that satisfy your -if condition.

Do you want instead to use -if "not $regioninfo" ?

- Phil