lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
https://sharp.pixelplumbing.com
Apache License 2.0
29.22k stars 1.29k forks source link

Converting HEIC to PNG requires global libvips #3816

Closed blok5025 closed 1 year ago

blok5025 commented 1 year ago

Possible bug

When doing: const data = await sharp(input) .png() .toBuffer(); On a HEIF type of file,

I get: "heif: Unsupported feature: Unsupported codec (4.3000)]"

Is this a possible bug in a feature of sharp, unrelated to installation?

Are you using the latest version of sharp?

lovell commented 1 year ago

Is the HEIF file using AV1 (AVIF) or HEVC (HEIC) compression? Did you see https://sharp.pixelplumbing.com/api-output#heif ?

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.

blok5025 commented 1 year ago

Is the HEIF file using AV1 (AVIF) or HEVC (HEIC) compression? Did you see https://sharp.pixelplumbing.com/api-output#heif ?

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.

Yes I am using HEIC as the input. Do you have any instructions for installing libvips globally and getting the conversion to work?

lovell commented 1 year ago

Did you see https://sharp.pixelplumbing.com/install#custom-libvips ?

blok5025 commented 1 year ago

Did you see https://sharp.pixelplumbing.com/install#custom-libvips ?

I doubt this can work inside of a Google Cloud Function. I couldn't find any ways of using Meson inside of Google Cloud to install dependencies.

Unless you know any workarounds?

lovell commented 1 year ago

Waiting for the HEVC patents to expire (c2036) will probably take less time. Good luck!

tomgreco commented 1 year ago

@lovell I'm a bit confused, so what exactly do we do to solve this issue?

I'm uploading images from my iPhone and trying to resize them to create thumbnails.

lovell commented 1 year ago

If you're dealing with patent-encumbered HEVC-compressed HEIC files and use a third-party runtime environment over which you have limited control then sharp is probably the wrong solution to your problem.