OS: macOS 27.0.1 on Apple Silicon (arm64)
Java Version: OpenJDK 21.0.12.1 (Homebrew, native arm64)
Tomcat Version: none – CommandBox 6.3.5 (Undertow)
Lucee Version: 5.4.8.2
For comparison, WebP writing works on our servers: Windows x86_64, Tomcat, Lucee 5.3.12.1.
Hi all,
writing WebP images fails on an Apple Silicon Mac, while reading WebP works fine. The same code runs without problems on our Windows x86_64 servers.
Repro
img = imageRead( expandPath( "./test.jpg" ) );
imageWrite( img, getTempDirectory() & "test.webp", true, 0.85 ); // fails
imageWrite( img, getTempDirectory() & "test.jpg", true, 0.85 ); // works
Error
Multiple exceptions ('long com.luciad.imageio.webp.WebPEncoderOptions.createConfig()';
FileStore The specified format has no associated registered ImageCodec.)
The first part is the UnsatisfiedLinkError of the native createConfig() method. A 0-byte .webp file is left behind.
Analysis
-
The bundle
lucee-server/bundles/org.lucee.gotson-webp-0.2.2.jarships these natives:native/Windows/x86 native/Windows/x86_64 native/Linux/x86, x86_64, aarch64, arm, armv6, armv7, ppc64 native/Mac/x86_64There is no
native/Mac/aarch64, so the encoder cannot load on an arm64 JVM on macOS. -
org.lucee.twelvemonkeys.imageio-webpis present too, but TwelveMonkeys WebP is read-only, which explains why reading works. -
In
lucee/extension-image(master),source/java/pom.xmlstill depends oncom.github.gotson:webp-imageio:0.2.2(released 2021). So I assume Lucee 6/7 with the current image extension behave the same on Apple Silicon. I haven’t tested Lucee 7 myself. -
gotson/webp-imageio has not added Mac aarch64 binaries (see PR #1: the maintainer wants reproducible builds).
Possible fix
com.github.usefulness:webp-imageio (currently 0.11.0, Apache 2.0, Java 11+) is a maintained fork of gotson/webp-imageio:
- it keeps the same package
com.luciad.imageio.webp, - it ships
native/Mac/aarch64/libwebp-imageio.dylibin addition to all platforms of 0.2.2.
It looks like a drop-in replacement for the dependency in the image extension:
<dependency>
<groupId>com.github.usefulness</groupId>
<artifactId>webp-imageio</artifactId>
<version>0.11.0</version>
</dependency>
Questions
- Can someone confirm whether WebP writing works on Apple Silicon with Lucee 7 and the current image extension?
- Would you consider switching the image extension to
com.github.usefulness:webp-imageio? Is there an existing ticket for this I should follow or comment on? - For Lucee 5.4: is there a supported way to use a newer webp-imageio build without patching the bundle in
lucee-server/bundles?
Current workaround
Run the local server on an x86_64 JDK under Rosetta 2, so the Mac/x86_64 native is used. Since Apple plans to limit Rosetta after macOS 27, that’s only a short-term option. For now we simply test image uploads on our dev server.
Happy to test a snapshot or a patched extension on Apple Silicon if that helps.
Thanks!