gen2brain / heic

HEIC image decoder
MIT License
9 stars 2 forks source link

"image: unknown format" in decoding image #2

Open storybehind opened 5 months ago

storybehind commented 5 months ago

After importing this library, decoding .heic file using standard image package produces image: unknown format error.

heic.Dynamic() prints cannot load library: libheif.so: cannot open shared object file: No such file or directory as this library is not installed on my machine. But, it's not falling back to WASM.

gen2brain commented 5 months ago

It does fallback, but it cannot detect the image probably because the image doesn't start with ????ftypheic, can you check the header of the file?

storybehind commented 5 months ago
invalid-magic-number-heic

The image starts like above. Some other heic files have same magic number as you commented above. I'm not sure of the reason for this difference. Just found a discussion on heic magic number.

gen2brain commented 5 months ago

Yeah, I know that discussion, but nothing is confirmed there, ftypmif1 can be used for both AVIF and HEIF. As for libheif, it also can handle AVIF and JPEG in HEIF, etc. This library only uses HEIC, i.e. HEVC in HEIF, I need to know if that is H.265 encoded or not. You can help with testing, i.e. try to add another line below, same as https://github.com/gen2brain/heic/blob/main/heic.go#L63 just with ftypmif1 instead of ftypheic and use replace directive in go.mod so you can test with your version. If it works I can include it here in the repo, but I am still not sure how to be precise here and if it would be correct.

gen2brain commented 5 months ago

If possible, please send me an image via email so I can test it.

storybehind commented 5 months ago

Attached requested image.

On Fri, Apr 5, 2024 at 1:29 PM Milan Nikolic @.***> wrote:

If possible, please send me an image via email so I can test it.

— Reply to this email directly, view it on GitHub https://github.com/gen2brain/heic/issues/2#issuecomment-2039190305, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEH55U4A7DINI2Q53JFMODY3ZKU7AVCNFSM6AAAAABFVMVTHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZZGE4TAMZQGU . You are receiving this because you authored the thread.Message ID: @.***>

gen2brain commented 5 months ago

Sorry, I do not see it attached. You can also send directly to private email if you want.