Page 1 of 2

Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-16T09:10:33-07:00
by The Guy from CGN
How can I preserve the EXIF while converting from TIF to TIF and TIF to JPG?

I tried to extract the EXIF into a separate file and add it while final conversation

Code: Select all

convert input.tif exif:input.exif
mogrify -set profile exif:input.exif pagoda_sm.tif
but I get this message:
convert: no APP1 data is available `input.exif' @ error/meta.c/WriteMETAImage/2422.
Even copy'n'paste into a search engine was not helpful for this error message. What is APP1?

Is there a possibility to keep the EXIF? If yes, what is the command?

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-16T11:50:55-07:00
by fmw42
I was under the impression that it would be copied on an simple convert. Can you post an example TIF? Did you try?

Code: Select all

magick input.tif output.tif
or

Code: Select all

magick input.tif output.jpg
mogrify is old and less functional that the magick command. It replaces convert when using IM 7.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T00:03:11-07:00
by The Guy from CGN
I have uploaded an example TIF: https://my.hidrive.com/lnk/Cg4k1owW

I tried magick as well as convert. In both cases the EXIF will be removed. I also tried:

Code: Select all

magick input.tif -define tiff:exif-properties=true output.tif
but the EXIF will be still removed.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T08:28:51-07:00
by fmw42
Your file does not list any EXIF properties.

Verbose information.

Code: Select all

Image: input.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: DirectClass
  Geometry: 738x766+0+0
  Resolution: 300x300
  Print size: 2.46x2.55333
  Units: PixelsPerInch
  Colorspace: sRGB
  Type: TrueColor
  Endianess: LSB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Pixels: 565308
    Red:
      min: 0  (0)
      max: 222 (0.870588)
      mean: 64.0168 (0.251046)
      standard deviation: 28.7652 (0.112805)
      kurtosis: 1.44355
      skewness: 1.09352
      entropy: 0.864703
    Green:
      min: 6  (0.0235294)
      max: 195 (0.764706)
      mean: 73.1449 (0.286843)
      standard deviation: 22.227 (0.0871648)
      kurtosis: 0.775626
      skewness: 0.495986
      entropy: 0.857878
    Blue:
      min: 0  (0)
      max: 97 (0.380392)
      mean: 5.36054 (0.0210217)
      standard deviation: 7.9438 (0.0311521)
      kurtosis: 5.26293
      skewness: 2.05755
      entropy: 0.556688
  Image statistics:
    Overall:
      min: 0  (0)
      max: 222 (0.870588)
      mean: 47.5074 (0.186304)
      standard deviation: 19.6453 (0.0770406)
      kurtosis: -0.537545
      skewness: 0.330918
      entropy: 0.759756
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 738x766+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: None
  Orientation: TopLeft
  Properties:
    date:create: 2019-07-17T15:27:12+00:00
    date:modify: 2019-07-17T15:27:12+00:00
    icc:copyright: Copyright (c) 1998 Hewlett-Packard Company
    icc:description: sRGB IEC61966-2.1
    icc:manufacturer: IEC http://www.iec.ch
    icc:model: IEC 61966-2.1 Default RGB colour space - sRGB
    signature: a57e1e05f38b0e6bc4489b8efea8a6d656d6730e7fd8ac4940c96c49f20ec92d
    tiff:alpha: unspecified
    tiff:artist: Rene Toepfer
    tiff:copyright: Copyright 2019 Rene Toepfer - www.rene-toepfer.de - Alle Rechte vorbehalten/All rights reserved
    tiff:endian: lsb
    tiff:photometric: RGB
    tiff:rows-per-strip: 3
  Profiles:
    Profile-8bim: 20176 bytes
    Profile-icc: 3144 bytes
    Profile-iptc: 172 bytes
      City[1,90]: 0x00000000: 254700                                        -%
      unknown[2,0]: 
      Byline[2,80]: Rene Toepfer
      Byline Title[2,85]: Dipl.-Ing. (FH), Fotograf, Grafi
      Copyright String[2,116]: Copyright 2019 Rene Toepfer - www.rene-toepfer.de - Alle Rechte vorbehalten/All rights reserved
    Profile-xmp: 6010 bytes
  Artifacts:
    filename: input.tif
    verbose: true
  Tainted: False
  Filesize: 1.6459MiB
  Number pixels: 565308
  Pixels per second: 30.0378MB
  User time: 0.000u
  Elapsed time: 0:01.018
  Version: ImageMagick 6.9.10-53 Q16 x86_64 2019-07-06 https://imagemagick.org

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T08:47:17-07:00
by The Guy from CGN
IrfanView shows me as EXIF what also is shown by identify:

Code: Select all

tiff:artist: Rene Toepfer
tiff:copyright: Copyright 2019 Rene Toepfer - www.rene-toepfer.de - Alle Rechte vorbehalten/All rights reserved
This what I want to have also in the output.tif/output.jpg.
By using convert or magick these data will be removed.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T08:55:09-07:00
by fmw42
That is not EXIF data. It is TIFF specific information.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T09:25:33-07:00
by The Guy from CGN
Why shows it IrfanView as EXIF?

But however, how can I get these information into the final JPG as EXIF?

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T09:29:03-07:00
by fmw42
Irfanview may be calling everything EXIF. I do not use it, so cannot say for sure what is properly EXIF data or not. Imagemagick will not write or modify EXIF. It only reads it. You can use exiftool to change or add EXIF data. See https://www.sno.phy.queensu.ca/~phil/exiftool/

What information do you need to preserve?

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T09:32:51-07:00
by The Guy from CGN
Even it is not the correct forum: Do the exiftool re-write a JPG/TIFF or will it just add the data?

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T09:34:38-07:00
by fmw42
It you want the "artist" and copyright. Then add those to the comments section of the file using Imagemagick. Then it would be copies.

See -comment or -set comment in the docs. https://imagemagick.org/script/command- ... hp#comment

convert image.tif -set comment "artist: ...." image.tif

I am not sure if this is done without reading and writing the image data.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T09:35:09-07:00
by fmw42
The Guy from CGN wrote: 2019-07-17T09:32:51-07:00 Even it is not the correct forum: Do the exiftool re-write a JPG/TIFF or will it just add the data?
I think it just adds the data. But you will have to read their docs to be sure.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-17T09:48:21-07:00
by fmw42
I have to admit, I am not sure I understand why the tiff: fields that contain artist and copyright are not copies from one tiff file to another with a simple convert. Perhaps it is because these are less used fields and Imagemagick only copies a few tiff fields that are always reported.

I note that exiftool does see those fields in your input image.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-18T01:19:53-07:00
by The Guy from CGN
I use EXIFTOOL meanwhile. I created an XMP template containing EXIF and IPTC. Prior converting the TIFF into JPG I run EXIFTOOL. While conversation from TIFF to JPG these data will be kept.

These are the codes (I run them automatically as a batch file afterwards Capture1 has convertered my RAW into TIFF):
EXIFTOOL

Code: Select all

exiftool -tagsfromfile "%LOCALAPPDATA%\CaptureOne\_capture1-skripte\exif\exif.xmp" -all:all -overwrite_original %1
MAGICK

Code: Select all

magick %1[0] -quality 95 -sampling-factor 4:2:2 -set filename:ausgabe "%%d\\%%t" %%[filename:ausgabe].jpg
The EXIF and IPTC data will not be shown at Irfanview but with EXIFTOOL and with Photoshop. Therefore it seems to me that Irfanview has a bug.

Thanks for your support! From my point of view this topic is closed.

P.S.: I considered your comment that CONVERT, MOGRIFY etc are only for compatibility reasons and they were replaced by MAGICK.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-07-18T08:54:56-07:00
by fmw42
Thanks for reporting your success and how to do that with exiftool. It will be helpful to others.

Convert is replaced by magick in IM 7. Magick has new functionality. Mogrify in IM 7 needs to be called as magick mogrify and just uses the old IM 6 mogrify. Nothing new in it. Also mogrify is more limited than convert/magick. So for processing one image, magick is better.

Re: Preserve EXIF while conversation from TIF to TIF/TIF to JPG

Posted: 2019-08-05T06:59:55-07:00
by 246246
The Guy from CGN wrote: 2019-07-17T09:25:33-07:00 Why shows it IrfanView as EXIF?

But however, how can I get these information into the final JPG as EXIF?
Accroding to the spec of Exif 2.3 http://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf
4.6.4 TIFF Rev. 6.0 Attribute InformationTable 4 lists the attribute information used in Exif, including the attributes given as mandatory in Baseline TIFF Rev. 6.0 RGB Full Color Images and TIFF Rev. 6.0 Extensions YCbCr Images, as well as the optional TIFF tags used by DSC and other systems. The contents are explained below.
it seems they considered it as a part of Exif. So I suppose exiftool or exiv2 treat them as a Exif.