Metadata Charset Problems

Started by billkgb, December 17, 2013, 01:53:07 PM

Previous topic - Next topic

billkgb

Hello there, having some problems with metadata after resizing it on Photoshop, it seems Photoshop convert the charset to utf-8, so i used exiftool with the following command:

exiftool -tagsfromfile @ -iptc:all -codedcharacterset= -charset iptc=latin1

It fixed  the Captions, but it also removes the keywords,  and it doesnt seem to convert characters like doublequotes(") so it fails rendering all the data aftter a doublequote.

So after researching i couln't find if its possible to read from one file and write in anoter, for example, i have the folder with the original were the metadata is ok, and and another folder with the resized wich are corrupted, a recursive command that will read from the file with the same name on originals and write all metadata to the new files, is that possible?

Also i found i could fix it with a custom config file, but im lacking some skillz, heres the code:

#---- My Own Tags start --------------------------------------------------------------------

# My own Tags "MyKeywords" & "MyCaption" & "MyHeadline" for Search & Replace
# in Keywords, Caption & Headline:

  %Image::ExifTool::UserDefined = (     
    'Image::ExifTool::Composite' => {
        MyKeywords => {
          Require => 'Keywords',
          ValueConv => q{
            my @list = ref $val ? @$val : ($val);
            my $changed;
            s/á/á/g and $changed = 1 foreach @list;
            return $changed ? \@list : undef;
          },
        },
        MyCaption => {
          Require => 'Caption-Abstract',
          ValueConv => q{ $val=~s/â"/"/g ? $val : undef },
        },
       
         MyHeadline => {
          Require => 'Title',
         ValueConv => q{ $val=~s/á/á/g ? $val : undef },
        },
      },
);


It works ok, nut now i need to add all the characters i want to switch, i figured how to add on the Keywords but cant make it to work on Caption or Headline, heres how it works on keywords:

ValueConv => q{
            my @list = ref $val ? @$val : ($val);
            my $changed;
            s/á/á/g and $changed = 1 foreach @list;
s/á/á/g and $changed = 1 foreach @list;
s/Ã/Á/g and $changed = 1 foreach @list;
            return $changed ? \@list : undef;
          },


how will it be on Caption and Headline?

Many thanks in advance for the help, and sorry for long text.
Best regards

Phil Harvey

Quote from: billkgb on December 17, 2013, 01:53:07 PM
So after researching i couln't find if its possible to read from one file and write in anoter, for example, i have the folder with the original were the metadata is ok, and and another folder with the resized wich are corrupted, a recursive command that will read from the file with the same name on originals and write all metadata to the new files, is that possible?

Yes.  Look at the copying examples (specifically the 13th example).

Quote ValueConv => q{
            my @list = ref $val ? @$val : ($val);
            my $changed;
            s/á/á/g and $changed = 1 foreach @list;
s/á/á/g and $changed = 1 foreach @list;
s/Ã/Á/g and $changed = 1 foreach @list;
            return $changed ? \@list : undef;
          },


how will it be on Caption and Headline?

Something like this:

        MyCaption => {
          Require => 'Caption-Abstract',
          ValueConv => q{
              my $changed;
              $val=~s/â"/"/g and $changed = 1;
              return $changed ? $val : undef;
          },
        },
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).