Author Topic: Missing Method CopyExif  (Read 1926 times)

ggblue

  • New Members
  • *
  • Posts: 14
Missing Method CopyExif
« on: March 29, 2015, 08:42:05 PM »
Hi evrybody,
is there any substitution for the elegant database-class method CopyExif?
(Example:
db.CopyEXIF("c:\temp\1.jpg","c:\temp\2.jpg",true)
)

In my old IM 3.6 workflow script this method was used to copy all exif metadata
of a source file to another file (a copy of the source, processed with photoshop).

I have checked (hopefully) all sample scripts, the imatch community board and the Object model, but found no hint.

Thanks a lot for any ideas...

ggblue

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Missing Method CopyExif
« Reply #1 on: March 30, 2015, 12:12:36 AM »
A short, but slightly misleading answer is no.

A less short answer is that in IMatch 5 you'd typically do this using file relations and propagation, since I'd expect that 1.jpg is a master and 2.jpg is a version.

An even longer answer is that in IMatch 5 all metadata manipulation is done using ExifTool and you can script ExifTool to do this.  There's a propagation script I wrote to do this which is in the script gallery.  But the reasons why I wrote that script have mostly been addressed in updates to Imatch, so even I don't use it any more.  But you can see how it's done.

There are caveats that are normally made about copying EXIF from one file to another.  From a JPG to JPG it's not so risky I guess.  I used to propagate EXIF but even I've become a little wary of doing so.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Missing Method CopyExif
« Reply #2 on: March 30, 2015, 08:38:51 AM »
Isolated methods like this have been removed because they work against the Metadata Working Group compliance rules and may cause EXIF and XMP to get out of synch - which would be bad. Just copying the EXIF data if the target file also has XMP can cause irritating and wrong results. If you really need to do this, you can to it with ExifTool directly, e.g. with exiftool -exif:all -tagsfromfile src.jpg -exif:all dst.jpg or similar.

I suggest you look into the comfortable metadata manipulation methods available in IMatch 5 scripting (TagInfo, TagData, TagValue), which are easy to use and also allow IMatch to stay in control of things and to apply mapping rules for EXIF/IPTC/XMP/GPS when writing the data to the actual file.

There are also built-in features to copy metadata, like Ferdinand explained. In addition to file relations with propagation there is Copy Attributes, the copy features in the Metadata Panel, the Batch Processor etc.

Ferdinand

  • 100 years since I was shot and a war was started
  • Global Moderator
  • *****
  • Posts: 1670
Re: Missing Method CopyExif
« Reply #3 on: March 30, 2015, 10:49:35 AM »
I didn't mention TagInfo, TagData, TagValue because it seems he wants to copy the whole block.  Or course if there are just a few fields that he is interested in then those scripting methods are definitely an option.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Missing Method CopyExif
« Reply #4 on: March 30, 2015, 12:57:51 PM »
Copying a whole EXIF 'block' without relocating maker notes to the new file size and location of the EXIF record is a recipe for problems.
ExifTool can do this, Phil knows enough about the various maker notes so ET is able to perform the required relocations for most file format and EXIF variants. I don't so I won't even try. It's easy to call ExifTool from a script, from the ECP or using  one of the other features in IMatch if so desired. In scripting, I'll stick to the 'safe' Tag classes.

ggblue

  • New Members
  • *
  • Posts: 14
Re: Missing Method CopyExif
« Reply #5 on: March 30, 2015, 08:37:59 PM »
Thanks to all for your helping lines.

I have recognized that the simple way may not for all purposes be the best.
You have convinced me, that copying all IPTC data may cause any problems in future...

Probably the better way is storing only a subset of the original metadata within the copy.

For that I'll (bite in the sour apple (old german saying like "get the pill down") and... )
write a multi line solution using the metadata classes. 

@ Mario: Is it possible under WinWrapBasic to get a deep sight into the values of a class instance
in debugging mode (similar to Visual Basic)?

Greetings from a stormy Germany
ggblue

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Missing Method CopyExif
« Reply #6 on: March 31, 2015, 08:03:44 AM »
The debugger in the scripting language allows you to inspect variables and objects alike.