lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.

Home Page:https://sharp.pixelplumbing.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

toFormat("jxl") throws an error

oscarotero opened this issue · comments

I'm using Sharp 0.33.4 with Node.js v22.3.0 on a macOS 12.7.5

The following code runs well in sharp:

import sharp from "sharp"

sharp("avatar.png")
  .resize(300, 200)
  .toFormat("webp")
  .toFile("avatar.webp")

but when I want to save it to jxl:

import sharp from "sharp"

sharp("avatar.png")
  .resize(300, 200)
  .toFormat("jxl")
  .toFile("avatar.jxl")

It shows the following error:

/Users/oscarotero/www/lumeland/issues/630/node_modules/sharp/lib/output.js:89
    const stack = Error();
                  ^

Error: VipsOperation: class "jxlsave" not found
    at Sharp.toFile (/Users/oscarotero/test/node_modules/sharp/lib/output.js:89:19)
    at file:///Users/oscarotero/test/sharp.mjs:6:4
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:474:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:109:5)

https://sharp.pixelplumbing.com/api-output#jxl

Requires libvips compiled with support for libjxl. The prebuilt binaries do not include this

Please see #2731 (comment)

Understood!!
Thanks for your time and sorry for the noise 🙏