Copying complete metadata, or overwriting image pixels only

Started by daz, June 17, 2021, 02:04:11 AM

Previous topic - Next topic

daz

I have a thermal image which includes binary radiometric data from a DJI H20T. I've reprocessed the image with different upper/lower temperature thresholds resulting in a new image with the same resolution, but without much metadata; no EXIF, XMP, binary thermal.

I can copy all metadata over with exiftool -TagsFromFile source.jpg -exif:all -xmp:all target.jpg, but there's no radiometric data, and I'd like to reprocess this image with different thresholds etc.

I thought maybe ImageMagick would work, using composite -compose dstover source.jpg target.jpg composite.jpg, no luck though. Can exiftool do this or should I look elsewhere?

Cheers

Phil Harvey

Try copying -makernotes as well in your first command to see if this helps.

- Phil
...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 ($).

daz

No luck unfortunately. Using a 965KB 640x512 JPEG, the processed file with the same dimensions is 125KB after copying exif from the original, somewhat indicating that there's no binary TIFF embedded. I'm getting this error:

Warning: [minor] Bad MakerNotes directory - DJI_20210609020057_0366_T.JPG

Luuk2005

Greetings daz, Im just curious which application does always destroy this metadata, when its reprocessing the images?
Im no ideas where to find radiometric-data, but you could experiment by trying to copy everything with something like...
exiftool -m -ee3 -U -api MakerNotes=2 -api RequestAll=3 -TagsFromFile source.jpg target.jpg

So if it copies your data, then you would just need to discover where this radiometric-data can be settled?
If nothing else, maybe posting the "Bad MakerNotes" file, to let the experts study the file, to discover a solution.
Windows8.1-64bit, exiftool-v12.11(standalone), sed-v4.0.7

Phil Harvey

I would also need to see the original image to be able to help more.

- Phil
...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 ($).

daz

Quote from: Luuk2005 on June 18, 2021, 09:57:46 AM
exiftool -m -ee3 -U -api MakerNotes=2 -api RequestAll=3 -TagsFromFile source.jpg target.jpg

This yields:

Warning: Error rebuilding maker notes (may be corrupt) - DJI_20210609020428_0437_T.JPG
Ignored superfluous tag name or invalid option: -ee3
    1 image files updated


I've attached the two images, DJI_20210609020428_0437_T.JPG is the original, straight off the camera, with all the radiometric data embedded. result.jpg is the output of a thermal ranging tool, I'd like to have the complete metadata from the original copied to the result.jpg, so I can essentially re-range a thermal image over and over again.

There has been a discussion on the H20T thermal images here before:
https://exiftool.org/forum/index.php?topic=11401.0

Is there no way to overwrite only the pixel data of a JPEG? Ie, copying result.jpg image data onto DJI_20210609020428_0437_T.JPG?

Phil Harvey

I'll take a look at this when I get a chance, but I'm busy this weekend.

Quote from: daz on June 19, 2021, 01:24:47 AM
Is there no way to overwrite only the pixel data of a JPEG? Ie, copying result.jpg image data onto DJI_20210609020428_0437_T.JPG?

There is.  Here is a Perl script I wrote to do just this.

- Phil
...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 ($).

daz

I wasn't able to get your script working on any of the thermal images unfortunately, it just renders out a grey image. Any other thoughts as to how this might be possible?

Phil Harvey

...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 ($).

Joanna Carter

I don't know if this of any use or not but I took your image and ran it through DxO PhotoLab

I augmented the contrast to reveal more detail.

daz

Quote from: Joanna Carter on July 08, 2021, 08:04:44 AM
I don't know if this of any use or not but I took your image and ran it through DxO PhotoLab

I augmented the contrast to reveal more detail.

Thanks but yeah no use unfortunately, the result.jpg image is generated from the radiometric data and references absolute temp values; you can adjust the upper/lower temp thresholds and the colour palette to generate different pseudo color images:

docker run -i \
  -v "$(pwd)":"$(pwd)" -w "$(pwd)" \
  djithermal \
  dji_irp -a process \
  --palette iron_red \
  --colorbar on,17,11 \
  -s DJI_20210609020428_0437_T.JPG -o result.raw

magick -depth 8 -size 640x512 RGB:result.raw result.jpg


While adjusting the brightness and contrast of the jpg can make objects stand out, the above essentially does the same thing but with absolute precision, ranging the image from 11°C to 17°C. I just wish there was a way to do this without throwing away be embedded radiometric data.