MikeKovarik / exifr

📷 The fastest and most versatile JS EXIF reading library.
https://mutiny.cz/exifr/
MIT License
1.04k stars 70 forks source link

Thumbnail extraction from HEIC file #43

Open TomoyukiAota opened 3 years ago

TomoyukiAota commented 3 years ago

Does exifr support extracting thumbnail from HEIC file?

With the demo application, thumbnail can be extracted from JPG file, but it says "File doesn't contain thumbnail" for HEIC file. I used the IMG_6996.HEIC and IMG_6996.JPG available in this link.

TomoyukiAota commented 3 years ago

I found the table in README.md that says extracting thumbnail is not supported for HEIC file. I should've checked it earlier, sorry about it.

Are there any future plans for supporting it? Also, out of curiosity, but are there any technical difficulties in supporting it?

MikeKovarik commented 3 years ago

Hello, thanks for opening this up. No problem it's Xed on the support matrix. Not supporting it now doesn't mean I don't want to implement it. I was actually looking into thumbnail extraction from TIFF files yesterday and gave HEIC a shot since you created this issue.

I was able to modify current code to find offset and length of the thumbnail (it's references under thmb box). So that is technically possible. But the problem is, it's just a raw encoded hvc1 data. There's no file structure around it. Unlike with JPEG where thumbnail is essentially fully featured JPEG file inside another JPEG that can be easily extracted and stand on its own.

image

So... I can give you the raw data but it's debatable how useful that is. Do I have plans to support it? I would love to. But my knowledge of the HEIF/ISOBMFF format is limited in this area. Unless someone is able to help me, I don't think I'll be able to fully support it.

offtopic: I would also like to support TIFF thumbnail extraction. There I at least know it's possible. And TIFF support will come earlier than HEIC.

TomoyukiAota commented 3 years ago

Thanks for the detailed answer!

But the problem is, it's just a raw encoded hvc1 data. There's no file structure around it. Unlike with JPEG where thumbnail is essentially fully featured JPEG file inside another JPEG that can be easily extracted and stand on its own. So... I can give you the raw data but it's debatable how useful that is.

I see... I agree that it is debatable how useful extracting the row hvc1 data for thumbnail is. I'm thinking of a use case to display the extracted thumbnail on a web browser. The raw encoded hvc1 data needs to be converted to the format that browsers support, but I'm not knowledgeable in this area either...