alexcorvi / heic2any

Converting HEIF/HEIF image formats to PNG/GIF/JPEG in the browser
https://alexcorvi.github.io/heic2any/
MIT License
626 stars 82 forks source link

EXIF GPS latitude and longitude are lost when HEIC is converted to jpeg #5

Open ryaa opened 4 years ago

ryaa commented 4 years ago

Here is the file that I tried to convert to jpeg (please unzip it to get the original HEIC image) and output jpeg does not contain EXIF GPS data.

cheers.heic.zip

The code is as follows:

        const HEICBlobFile: Blob = await this.makeImageIntoBlob(heicImagePath);

        const JPEGBlobFile: Blob = await heic2any({
            // required: the HEIF blob file
            blob: HEICBlobFile,
            // (optional) MIME type of the target file
            // it can be "image/jpeg", "image/png" or "image/gif"
            // defaults to "image/png"
            toType: 'image/jpeg',
            // conversion quality
            // a number ranging from 0 to 1
            quality: 0.8
        });

and then I save the jpeg file and it has no GPS data in EXIF.

ryaa commented 4 years ago

It seems that EXIF can't be preserved since canvas is used to convert the image.

alexcorvi commented 4 years ago

This is a current limitation of the library. The development process of this library is focusing on viewing a browser-consumable version of a heic file. So this would typically be solved in the issue. I'll keep this issue open and note any updates on the process.