sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Issues reading heic files and converting them into webp

Open mikedpid opened this issue 3 months ago • 1 comments

Possible install-time or require-time problem

You must confirm both of these before continuing.

Are you using the latest version of sharp?

  • [X] 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.

Are you using a supported runtime?

  • [X] I am using Node.js with a version that satisfies ^18.17.0 || ^20.3.0 || >=21.0.0
  • [ ] I am using Deno
  • [ ] I am using Bun

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

Are you using a supported package manager and installing optional dependencies?

  • [X] I am using npm >= 10.1.0 with --include=optional
  • [ ] I am using yarn >= 3.2.0
  • [ ] I am using pnpm >= 7.1.0 with --no-optional=false
  • [ ] I am using Deno
  • [ ] I am using Bun

If you cannot confirm any of these, please upgrade to the latest version of your chosen package manager and ensure you are allowing the installation of optional or multi-platform dependencies before opening an issue.

What is the complete error message, including the full stack trace?

Failed to process image variants: Failed to create large variant: source: bad seek to 2104971\nsource: bad seek to 2104955\nsource: bad seek to 2104947\nsource: bad seek to 2104943\nsource: bad seek to 2104941\nsource: bad seek to 2104940\nheif: Error while loading plugin: Support for this compression format has not been built in (11.6003)\nheif: Error while loading plugin: Support for this compression format has not been built in (11.6003)","stack":"Error: Failed to process image variants: Failed to create large variant: source: bad seek to 2104971\nsource: bad seek to 2104955\nsource: bad seek to 2104947\nsource: bad seek to 2104943\nsource: bad seek to 2104941\nsource: bad seek to 2104940\nheif: Error while loading plugin: Support for this compression format has not been built in (11.6003)\nheif: Error while loading plugin: Support for this compression format has not been built in (11.6003)\n at ImageProcessingJob.createImageVariants (file:///app/app/jobs/image_processing_job.js:94:19)\n at async ImageProcessingJob.process (file:///app/app/jobs/image_processing_job.js:55:30)\n at async #processJob (file:///app/node_modules/@nemoventures/adonis-jobs/build/commands/queue/queue_work.js:224:12)\n at async /app/node_modules/bullmq/dist/cjs/classes/worker.js:533:32\n at async trace (/app/node_modules/bullmq/dist/cjs/utils/index.js:288:20)\n at async Worker.retryIfFailed (/app/node_modules/bullmq/dist/cjs/classes/worker.js:819:24)

What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?

npm install --verbose --foreground-scripts sharp npm verbose cli /usr/local/bin/node /usr/local/bin/npm npm info using [email protected] npm info using [email protected] npm verbose title npm install sharp npm verbose argv "install" "--loglevel" "verbose" "--foreground-scripts" "sharp" npm verbose logfile logs-max:10 dir:/root/.npm/_logs/2025-11-07T14_04_12_802Z- npm verbose logfile /root/.npm/_logs/2025-11-07T14_04_12_802Z-debug-0.log npm http fetch GET 200 https://registry.npmjs.org/sharp 231ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/detect-libc 56ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/semver 82ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm64 110ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-arm64 123ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-x64 123ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm 127ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm64 128ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-riscv64 130ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-x64 131ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-arm64 134ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm 134ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-x64 140ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-x64 136ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-s390x 139ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-arm64 137ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-ppc64 139ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-riscv64 140ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-s390x 139ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-wasm32 141ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-arm64 141ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-x64 142ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-ppc64 147ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-ia32 69ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-arm64 100ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-x64 153ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-x64 55ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@emnapi%2fruntime 60ms (cache miss) npm verbose reify failed optional dependency /app/node_modules/@img/sharp-win32-x64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-win32-ia32 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-win32-arm64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-wasm32 npm verbose reify failed optional dependency /app/node_modules/@emnapi/runtime npm verbose reify failed optional dependency /app/node_modules/@img/sharp-linuxmusl-x64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-linuxmusl-arm64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-linux-s390x npm verbose reify failed optional dependency /app/node_modules/@img/sharp-linux-riscv64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-linux-ppc64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-linux-arm64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-linux-arm npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-linuxmusl-x64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-linuxmusl-arm64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-linux-s390x npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-linux-riscv64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-linux-ppc64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-linux-arm64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-linux-arm npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-darwin-x64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-libvips-darwin-arm64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-darwin-x64 npm verbose reify failed optional dependency /app/node_modules/@img/sharp-darwin-arm64 npm verbose reify failed optional dependency /app/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64 npm verbose reify failed optional dependency /app/node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64 npm verbose reify failed optional dependency /app/node_modules/@msgpackr-extract/msgpackr-extract-linux-arm npm verbose reify failed optional dependency /app/node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64 npm verbose reify failed optional dependency /app/node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64 npm http cache @emnapi/runtime@https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.7.0.tgz 1ms (cache hit) npm http fetch GET 200 https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.7.0.tgz 85ms (cache miss) npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 260ms npm http fetch GET 200 https://registry.npmjs.org/validator 626ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/@vinejs%2fvine 48ms (cache miss)

up to date, audited 835 packages in 2s

138 packages are looking for funding run npm fund for details

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

System:
   OS: Linux 6.8 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
   CPU: (24) x64 AMD Ryzen 9 3900 12-Core Processor
   Memory: 121.18 GB / 125.71 GB
   Container: Yes
   Shell: 5.2.15 - /bin/bash
 Binaries:
   Node: 22.21.1 - /usr/local/bin/node
   Yarn: 1.22.22 - /usr/local/bin/yarn
   npm: 10.9.4 - /usr/local/bin/npm
 npmPackages:
   sharp: ^0.34.4 => 0.34.5 

Im using libvips which ive built from source, the outputs look like this:

Sharp version: {
  aom: '3.13.1',
  archive: '3.8.2',
  cairo: '1.18.4',
  cgif: '0.5.0',
  exif: '0.6.25',
  expat: '2.7.3',
  ffi: '3.5.2',
  fontconfig: '2.17.1',
  freetype: '2.14.1',
  fribidi: '1.0.16',
  glib: '2.86.1',
  harfbuzz: '12.1.0',
  heif: '1.20.2',
  highway: '1.3.0',
  imagequant: '2.4.1',
  lcms: '2.17',
  mozjpeg: '0826579',
  pango: '1.57.0',
  pixman: '0.46.4',
  png: '1.6.50',
  'proxy-libintl': '0.5',
  rsvg: '2.61.2',
  spng: '0.7.4',
  tiff: '4.7.1',
  vips: '8.17.3',
  webp: '1.6.0',
  xml2: '2.15.1',
  'zlib-ng': '2.2.5',
  sharp: '0.34.5'
}
HEIF support: {
  id: 'heif',
  input: { file: true, buffer: true, stream: true, fileSuffix: [ '.avif' ] },
  output: { file: true, buffer: true, stream: true, alias: [ 'avif' ] }
}
All formats: [
  'jpeg',   'png',
  'webp',   'tiff',
  'magick', 'openslide',
  'dz',     'ppm',
  'fits',   'gif',
  'svg',    'heif',
  'pdf',    'vips',
  'jp2k',   'jxl',
  'rad',    'dcraw',
  'raw'
]

mikedpid avatar Nov 07 '25 14:11 mikedpid

Im using libvips which ive built from source

It looks like you're using prebuilt binaries, which do not support HEIC/HEVC. Please see https://sharp.pixelplumbing.com/install/#building-from-source for the additional prerequisites to compile sharp against a globally-installed libvips.

lovell avatar Nov 07 '25 14:11 lovell