Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom libvips loads and saves HEIC, pdf, etc. but Sharp not #4126

Closed
3 of 4 tasks
michielswaanen opened this issue Jun 7, 2024 · 2 comments
Closed
3 of 4 tasks

Custom libvips loads and saves HEIC, pdf, etc. but Sharp not #4126

michielswaanen opened this issue Jun 7, 2024 · 2 comments

Comments

@michielswaanen
Copy link

Possible bug

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

  • Running npm install sharp completes without error.
  • Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System:
    OS: Linux 6.6 Alpine Linux
    CPU: (6) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 13.69 GB / 15.62 GB
    Container: Yes
    Shell: 1.36.1 - /bin/ash
  Binaries:
    Node: 18.19.0 - /usr/local/bin/node
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 9.2.0 - /usr/local/bin/pnpm
  npmPackages:
    sharp: ^0.33.4 => 0.33.4

Does this problem relate to file caching?

The default behaviour of libvips is to cache input files, which can lead to EBUSY or EPERM errors on Windows.
Use sharp.cache(false) to switch this feature off.

Didn't test this because I'm not running on Windows

  • Adding sharp.cache(false) does not fix this problem.

What are the steps to reproduce?

Run bash scripts/start.sh to get started, Docker is a prerequisite.

https://github.com/michielswaanen/debug-sharp-custom-libvips

What is the expected behaviour?

Sharp should convert the custom file types added to the custom libvips build. While libvips can handle these conversions, Sharp currently does not.

Libvips config:

enable debug: false
enable deprecated: true
enable modules: false
enable cplusplus: true
enable RAD load/save: true
enable Analyze7 load/save: true
enable PPM load/save: true
enable GIF load: true
use fftw for FFTs: true
SIMD support with highway: false
accelerate loops with ORC: true
ICC profile support with lcms: true
zlib: true
text rendering with pangocairo: true
font file support with fontconfig: true
EXIF metadata support with libexif: true
JPEG load/save with libjpeg: true
JXL load/save with libjxl: false (dynamic module: false)
JPEG2000 load/save with OpenJPEG: true
PNG load/save with libspng: true
PNG load/save with libpng: false
selected quantisation package: imagequant
TIFF load/save with libtiff: true
image pyramid save with libarchive: false
HEIC/AVIF load/save with libheif: true (dynamic module: false)
WebP load/save with libwebp: true
PDF load with PDFium: true
PDF load with poppler-glib: false (dynamic module: false)
SVG load with librsvg: true
EXR load with OpenEXR: true
OpenSlide load: false (dynamic module: false)
Matlab load with libmatio: false
NIfTI load/save with niftiio: false
FITS load/save with cfitsio: true
GIF save with cgif: true
selected Magick package: none (dynamic module: false)
Magick API version: none
Magick load: false
Magick save: false

Please provide sample image(s) that help explain this problem

image

@lovell
Copy link
Owner

lovell commented Jun 7, 2024

Please see https://sharp.pixelplumbing.com/install#building-from-source for the extra dependencies required to build from source.

@michielswaanen
Copy link
Author

Adding the following line to the Dockerfile + pnpm add node-addon-api node-gyp did the trick.

ENV SHARP_FORCE_GLOBAL_LIBVIPS=1

Thanks for the help, somehow looked over this in the docs 👀

@lovell lovell closed this as completed Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants