Quarkus extension by SiteNetSoft for image processing with libvips: load uploads, read
their header, EXIF and ICC profile, turn them upright, make thumbnails, resize, crop, convert colour profiles, and save
to JPEG, PNG, WebP, AVIF or GIF. It calls the system's libvips through the Java Foreign Function & Memory API
(java.lang.foreign) and works in JVM mode, dev mode and native image.
Status: experimental. Nothing is published to Maven Central yet; build it with mvn install.
libvips 8.15 or later must be installed on every machine that runs the application; the extension never bundles it.
| System | Install |
|---|---|
| Debian 13, Ubuntu 24.04 and later | apt install libvips42t64 (older releases: libvips42) |
| Alpine | apk add vips |
| Fedora | dnf install vips |
| RHEL, Rocky, Alma | dnf install vips from EPEL |
| macOS | untested |
To save AVIF on Debian or Ubuntu, also install libheif's AV1 encoder: libheif-plugin-aomenc. To read HEIC (iPhone
photos), install libheif-plugin-libde265: without it, Ubuntu 24.04 decodes HEIC as an all-black image, with no
error.
<dependency>
<groupId>org.sitenetsoft</groupId>
<artifactId>quarkus-libvips</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>@Inject
Libvips libvips;
byte[] webpThumbnail(byte[] upload) {
try (Image thumbnail = libvips.thumbnail(upload, 800, ThumbnailOptions.DEFAULT)) {
return thumbnail.save(SaveOptions.webp(80));
}
}Close every Image (try-with-resources), and call libvips from a worker thread: on a Vert.x event loop the image
methods throw BlockingOperationNotAllowedException (use @Blocking or executeBlocking). The packaged application
(java -jar target/quarkus-app/quarkus-run.jar), dev mode and native executables need no JVM flag; tests need
--enable-native-access=ALL-UNNAMED in the Surefire and Failsafe argLine. On glibc-based Linux, run long-lived
servers with jemalloc (see the installation guide).
- Inputs over 128 MiB or 268 402 689 pixels are refused before any pixel is decoded (
quarkus.libvips.limits.*). - Every loader and saver libvips marks untrusted (PDF, SVG, ImageMagick, JPEG 2000, JPEG XL, PPM, …) is blocked.
system,globalbalanceandremosaiccan never run; file-name arguments must be built-in profiles or absolute regular files, and should come from configuration only.- Damaged uploads load as far as their data goes (
quarkus.libvips.fail-on=none); one property makes them fail.
The guides are in docs/modules/ROOT/pages: installation, usage, security and limits,
native image, and the configuration reference (generated by mvn -Pdocs package). What the extension works around in
its binding library is in docs/upstream-gaps.md.
For plain Java applications without Quarkus, vips-ffm binds libvips through the same Foreign Function & Memory API.
Apache License 2.0, see LICENSE.