Copy all tags?

Added by H.-J. R. about 3 years ago


since I did not find an appropriate command in the documentation, I ask here.

Is there a way to copy all tags from one image to another?

I am aware that this could cause severe problems. But I need it for the following problem.
My scan software delivers the raw scanner data in TIF files with 2 or 3 sub-images (high-resolution image, preview image, IR-channel). I want to tweak the sub-images and then process the result further with the scan software. Thus I need to preserve all the tags, otherwise the software would not properly recognize the image. So I use imagemagick to extract the sub-images, tweak them with imageJ (keeping the pixel dimensions) and re-assemble everything again with imagemagick. I would then copy all tags from the original to the tweaked TIF. I tried with EXIFtool, but it does not copy all tags.


Replies (2)

RE: Copy all tags? - Added by Robin Mills about 3 years ago

Yes, you can pipe metadata from one image to another as follows:

$ exiv2 -ea- foo.jpg | exiv2 -ia- man.png
The option: -ea- says extract all metadata to std-out.

The option: -ia- say insert all metadata from std-in.

You can choose a different family: a = all, e = Exif, i = iptc, x = xmp. For example: -ee- says extract Exif metadata to stdout.

The feature is implemented using the .exv file format. This is a "pure metadata" JPG. You can create .exv files from the command line with the options: -ea --force --verbose

There is a restriction concerning metadata which is read-only. For example, you cannot change the resolution, rows or columns of the metadata and they will be silently ignored.

Exiv2 does not handle multi-page image files. I have successfully used libtiff's tiffsplit and tiffcp programs to extract individual images, modify the metadata, and reassemble the multi-page TIFF.

RE: Copy all tags? - Added by H.-J. R. about 3 years ago

Thanks for the rapid answer.

Since I am not (yet) familiar with exiv2 I will have to see how to handle this.