Fotoware Fotostation custom fields read,write

Started by Archive, May 12, 2010, 08:53:56 AM

Previous topic - Next topic

Archive

[Originally posted by mella on 2006-09-07 10:43:32-07]

Hi,

I am working with project where I must read IPTC information from JPG/TIF images.

IPTC info is written into file using Fotostation and I also need to use custom fields.

Where I can find information how to read and write these fields?

Field IDs are 200 (custom field 01) - 219 (custom field 20).

I found that I can read these fields like this:

Code:
use Image::ExifTool 'ImageInfo';
use Data::Dumper qw(Dumper);

my @field_list = (
#'IPTC_200', # CANNOT READ custom field 01
#'IPTC_201', # CANNOT READ custom field 02
'ObjectPreviewData', # custom field 03
'IPTC_203', # custom field 04
'IPTC_204', # custom field 05
'IPTC_205', # custom field 06
'IPTC_206', # custom field 07
'IPTC_207', # custom field 08
'IPTC_208', # custom field 09
'IPTC_209', # custom field 10
'IPTC_210', # custom field 11
'IPTC_211', # custom field 12
'IPTC_212', # custom field 13
'IPTC_213', # custom field 14
'IPTC_214', # custom field 15
'IPTC_215', # custom field 16
'IPTC_216', # custom field 17
'IPTC_217', # custom field 18
'IPTC_218', # custom field 19
'IPTC_219', # custom field 20
);
my $image_data = ImageInfo($filename, \@field_list, { List => 0, Duplicates => 0 });
print Dumper($image_data);

I decided to use custom field 04-09, because 01-03 I did not found.

OK, now I can read these fields but I cannot write them back same way:
Code:
  my $image = Image::ExifTool->new($image_path);
   my $key = 'IPTC_203';
   my ($success, $errStr) = $image->SetNewValue($key, 'this is custom field 04 value');
   print "$key SUCCESS=$success, ERR=$errStr\n";
   if( $success ) {
      print "$key SUCCESS=$success\n";
   } else {
      print "$key SUCCESS=$success, ERR=$errStr\n";
   }

response is: IPTC_204 SUCCESS=0, ERR=Tag 'IPTC_204' does not exist

1) How can I write these fields back into JPG/TIF file?

2) 'ReleaseTime' and 'TimeCreated' fields are string[11] and I used them to store free text (march 2005) instead of hh:mm:ss

* field type string[11] is found from TagNames documentation

It was possible to write 'march 2005' using Fotostation and ExifTool managed to read it from JPG file, but it seems to impossible to write it back. Do I need to configure something or should I use other field?

Meelis

Archive

[Originally posted by exiftool on 2006-09-07 11:45:58-07]

1) (Gee, it seems like I just answered this same question, but for EXIF tags...) You can define your own IPTC tags
for writing, or override the existing definitions by creating a .ExifTool_config file in your home directory.  See the
ExifTool_config file in the distribution for an example.  The example file shows how to define new XMP and PNG
tags, but defining new IPTC tags is similar:

If you want to add the new tags to the IPTC application record (record 2), then you do something like this:

Code:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::IPTC::ApplicationRecord' => {
        200 => {
            Name => 'IPTC_200',
            Format => 'string[0,64]',
        },
    },
);

You have to define a format for each tag.  See lib/Image/ExifTool/IPTC.pm for examples, and
lib/Image/ExifTool/README for details about the tag hash entries.

2) In general, it is best not to write illegal values to tags.  ExifTool does some validation of tag values,
and in this case it is catching the error because it translates all date/times to EXIF format.  See
FAQ number 5 for an
explanation.  If you really want to write "march 2005", perhaps a comment tag could be used instead.

- Phil

Archive

[Originally posted by mella on 2006-09-08 18:14:56-07]

Hi,
I made Additional definitions in %Image::ExifTool::UserDefined hash and now it works!

Thanks,
Meelis