Reputation: 61
I am using arm64 linux node20 runtime.
My function is able to successfully convert most other image/* types to .webp, except for .heif files.
When a .heic file is added, I get the following error:
2024-10-29T17:56:11.300Z f75b6efa-4216-42ff-ac2a-87aaaaadb1f7 ERROR Invoke Error {
"errorType": "Error",
"errorMessage": "source: bad seek to 2994402\nheif: Error while loading plugin: No decoding plugin installed for this compression format (11.6003)",
"message": "source: bad seek to 2994402\nheif: Error while loading plugin: No decoding plugin installed for this compression format (11.6003)",
"stack": [
"Error: source: bad seek to 2994402",
"heif: Error while loading plugin: No decoding plugin installed for this compression format (11.6003)",
" at Sharp.toBuffer (/var/task/node_modules/sharp/lib/output.js:163:17)",
" at exports.handler (/var/task/index.js:91:8)"
]
}
I am not familiar with sharp or image processing at all and having a hard time understanding the issue. Can someone please point me in the right direction?
The library seems to have been installed properly since other formats, like .avif, .jpg, etc. are converted just fine.
Here's my node_modules if that helps -
Upvotes: 0
Views: 335
Reputation: 702
The pre-built sharp versions do not include HEIF (particularly, not HEIC, see https://github.com/lovell/sharp/issues/4132#issuecomment-2178591889). Note that the web page for sharp doesn't claim it can do HEIF, and https://sharp.pixelplumbing.com/api-output#heif states "Support for patent-encumbered HEIC images using hevc compression requires the use of a globally-installed libvips compiled with support for libheif, libde265 and x265."
You can build it yourself - there are instructions at https://sharp.pixelplumbing.com/install#building-from-source which should be enough to enable it.
Note that HEIF doesn't necessarily mean HEIC, but that is usually what people expect to see.
Upvotes: 0