libheif
libheif copied to clipboard
Exif data lost during conversion
Hello, First of all thank you so much for this awesome library
So, I have tried the demo live at https://strukturag.github.io/libheif,
I wanted to know if it is by design that the converted file does not have EXIF data
Test FIle - https://drive.google.com/file/d/1c4IDtTjdK_FAl-tDbuNVOTWjGOLyUGnU/view?usp=sharing
Thanks in advance!!
Using heif-convert it Exif-data a composed in a sensible way (first look) Using heif-thumbnailer it does not work, because heif-thumbnailer creats png but not jpeg. I use a version 1.12.0 from Packman
The HEIF-ENC doesn't copy exif details from jpeg either.
I have tried conversion from JPEG to HEIC, the command: heif-enc.exe -q 50 image.jpg -o image.heif succesfully creates a heif-file, but all exif details, camera paramenters, gps coordinates are lost during the conversion.
Could you please help with this.
How to deal with this problem
@ClearSeve and @liero0 : I have a little script which converts HEIF to jpg keeping exif-data
#!/bin/bash
tmp=`basename $0`
tmp=$tmp$$
mkdir /tmp/$tmp
USAGE="usage $0 file1 file2 ... fileN"
if [ "$#" == "0" ] ; then
echo $USAGE
exit 1
fi
while (( "$#" )); do
fullheifname=$1
#echo `dirname $fullheifname`/`basename $fullheifname .HEIC`.HEIC
if [ -f `dirname $fullheifname`/`basename $fullheifname .HEIC`.HEIC ] ; then
echo convert `basename $fullheifname`
heifname=`basename $fullheifname .HEIC`
jpgname=$heifname.jpg
heif-convert $fullheifname /tmp/$tmp/$jpgname
echo heif-convert executed
jhead -ft -n%Y%m%d_%H%M%S /tmp/$tmp/$jpgname
echo jhead executed
# ls -alst /tmp/$tmp
newheifname=`ls /tmp/$tmp/*.jpg`
newheifname=`basename $newheifname .jpg`
newheifname=$newheifname.HEIC
mv $fullheifname `dirname $fullheifname`/$newheifname
mv /tmp/$tmp/*.jpg `dirname $heifname`
else
echo $fullheifname does not exist or is not a HEIC-file
fi
shift
done
rm -r /tmp/$tmp
The encoder sample project in my libheif-sharp-samples repository preserves the EXIF and ICC metadata when encoding. Binaries can be downloaded from the releases page: https://github.com/0xC0000054/libheif-sharp-samples/releases
heif-enc
should now preserve EXIF and XMP information and also respects the EXIF Orientation of the JPEG.
7a3be91dc80e4c332a0cbb141209e3ba26dad70c
280ab284086f0458703a98c791187ba728429b09
4d9f13b8e00220193dc3e0b2bcd655ca0e9fa02d
Heic-Convert-installer.zip I have made a small script for the job: HeicConvert is a script which, when installed, will create an icon on your Linux desktop.
Dragging and dropping any image on the HeicConvert icon will create a heic format copy of the image in the same location as the original image. For example the file DSC02422.JPG dropped on the icon will result in the creation of another file DSC02422.heic. Exif information of the jpg file will be copied to the generated heic file.
Exif and XMP are copied over to the output of heif-enc since v1.14.0. It also modifies the orientation tags since still a couple of viewers falsely use these to rotate HEIF images.
Exif and XMP are copied over to the output of heif-enc since v1.14.0. It also modifies the orientation tags since still a couple of viewers falsely use these to rotate HEIF images.
Thanks @farindk for your quick reply. You did mention it earlier too, however v1.14.0 is still not available in Ubuntu 22.04 LTS repositories. My script can be used for drag and drop conversion to heic (it uses heif-enc). While using heif-enc v1.14.0+, the exiftool step can be commented out from the script.