haraldk / TwelveMonkeys

TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO
https://haraldk.github.io/TwelveMonkeys/
BSD 3-Clause "New" or "Revised" License
1.91k stars 315 forks source link

Building against JMagick 6.7.8 #1025

Closed pgrt closed 1 month ago

pgrt commented 1 month ago

Hello,

I am working on the packaging of TwelveMonkeys in Debian. When I tried to build version 3.11.0 against JMagick 6.7.8, I stumbled upon:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project common-image: Compilation failure: Compilation failure: [ERROR] /<>/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java:[157,31] cannot find symbol [ERROR] symbol: variable GrayscaleMatteType [ERROR] location: interface magick.ImageType [ERROR] /<>/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java:[163,31] cannot find symbol [ERROR] symbol: variable PaletteMatteType [ERROR] location: interface magick.ImageType [ERROR] /<>/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java:[169,31] cannot find symbol [ERROR] symbol: variable TrueColorMatteType [ERROR] location: interface magick.ImageType [ERROR] /<>/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java:[175,31] cannot find symbol [ERROR] symbol: variable ColorSeparationMatteType [ERROR] location: interface magick.ImageType

because the Matte attributes of magick.ImageType have been renamed to Alpha. I wrote the simple enclosed patch to allow the software to build.

jmagick7.txt

Best,

Pierre

haraldk commented 1 month ago

Thanks Pierre,

I'll look into this next week when I'm back in the office!

The long time plan is to get rid of the JMagick/ImageMagick dependency, but this might be a good solution in the mean time.

haraldk commented 1 month ago

Just a quick update: Do you actually need JMagick support in TwelveMonkeys? Otherwise I think I'll just remove the entire dependency now, as there's not much use of it anyway, as far as I know. And it has the added benefit of removing some dependencies with security issues.

pgrt commented 1 month ago

Hi @haraldk

Thanks for looking at my work!

Well, as far as I can see it is (at least?) needed by MagickUtil.java in TwelveMonkeys, but if you are suggesting to rework this file to avoid depending on jmagick then I think it makes sense :)

Best, Pierre

haraldk commented 1 month ago

My suggestion is to completely remove the classes Magick, MagickAccelerator and MagickUtil + remove the one usage of MagickAccelerator.filter() from ResampleOp. This allows us to safely remove the JMagick dependency, and should not make any difference, as ResampleOp already implements the required code in Java.

pgrt commented 1 month ago

Acknowledged, this sounds sensible!

And I can confirm no reverse dependency of TwelveMonkeys in Debian would suffer from this move.

haraldk commented 1 month ago

Fixed in 5e5d530.