mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2026-09-16 18:12:54 +00:00
Try run with GraphicsMagick
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
# Image provides a container in which to run ImageMagick transformations for Alfresco Content Services.
|
||||
|
||||
# ImageMagick is from ImageMagick Studio LLC. See the license at http://www.imagemagick.org/script/license.php or in /ImageMagick-license.txt.
|
||||
# Image provides a container in which to run GraphicsMagick transformations for Alfresco Content Services.
|
||||
#
|
||||
# PRODMAN-916 / ACS-12649 PoC: this engine has been switched from the custom (capability-reduced)
|
||||
# ImageMagick build to the publicly available GraphicsMagick package from EPEL, installed with its
|
||||
# full default capability set (delegates are NOT stripped, unlike the custom ImageMagick build).
|
||||
#
|
||||
# GraphicsMagick is from the GraphicsMagick Group. See http://www.graphicsmagick.org/ .
|
||||
|
||||
# More infos about this image: https://github.com/Alfresco/alfresco-docker-base-java
|
||||
ARG JAVA_BASE_IMAGE=alfresco/alfresco-base-java:jre17-rockylinux9@sha256:f98833508b7be8c4b44a25450f9faac44cacfdc075f2295e02836b93fd05bb9c
|
||||
FROM ${JAVA_BASE_IMAGE}
|
||||
|
||||
# For other ImageMagick versions please look at https://github.com/Alfresco/imagemagick-build tags
|
||||
ARG IMAGEMAGICK_VERSION=7.1.2-13-ci-1
|
||||
|
||||
ENV IMAGEMAGICK_RPM_URL=https://nexus.alfresco.com/nexus/service/local/repositories/thirdparty/org/imagemagick/imagemagick-distribution/${IMAGEMAGICK_VERSION}/imagemagick-distribution-${IMAGEMAGICK_VERSION}
|
||||
ENV IMAGEMAGICK_DEP_RPM_URL=https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
|
||||
ENV JAVA_OPTS=""
|
||||
|
||||
# Set default user information
|
||||
@@ -21,14 +20,13 @@ ARG USERID=33002
|
||||
|
||||
COPY target/${env.project_artifactId}-${env.project_version}.jar /usr/bin
|
||||
|
||||
# Install GraphicsMagick from EPEL (public package, full capability - no reduced/stripped delegates).
|
||||
RUN ln /usr/bin/${env.project_artifactId}-${env.project_version}.jar /usr/bin/${env.project_artifactId}.jar && \
|
||||
yum install -y $IMAGEMAGICK_DEP_RPM_URL && \
|
||||
if [ "$(uname -m)" = "x86_64" ]; then \
|
||||
yum install -y ${IMAGEMAGICK_RPM_URL}-el9.rpm ${IMAGEMAGICK_RPM_URL}-libs-el9.rpm; \
|
||||
else \
|
||||
yum install -y ${IMAGEMAGICK_RPM_URL}-el9-aarch64.rpm ${IMAGEMAGICK_RPM_URL}-libs-el9-aarch64.rpm; \
|
||||
fi && \
|
||||
yum clean all
|
||||
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
|
||||
dnf install -y dnf-plugins-core && \
|
||||
(dnf config-manager --set-enabled crb || true) && \
|
||||
dnf install -y GraphicsMagick && \
|
||||
dnf clean all && rm -rf /var/cache/dnf
|
||||
|
||||
ADD target/generated-resources/licenses /licenses
|
||||
ADD target/generated-resources/licenses.xml /licenses/
|
||||
|
||||
+4
-2
@@ -240,8 +240,10 @@ public final class ImageMagickOptionsBuilder
|
||||
StringJoiner args = new StringJoiner(" ");
|
||||
if (alphaRemove != null && alphaRemove)
|
||||
{
|
||||
args.add("-alpha");
|
||||
args.add(("remove"));
|
||||
// GraphicsMagick has no "-alpha remove"; the equivalent is compositing onto a white background.
|
||||
args.add("-background");
|
||||
args.add("white");
|
||||
args.add("-flatten");
|
||||
}
|
||||
if (autoOrient != null && autoOrient)
|
||||
{
|
||||
|
||||
+5
-2
@@ -78,8 +78,10 @@ public class ImageMagickCommandExecutor extends AbstractCommandExecutor
|
||||
{
|
||||
RuntimeExec runtimeExec = new RuntimeExec();
|
||||
Map<String, String[]> commandsAndArguments = new HashMap<>();
|
||||
// GraphicsMagick is a single dispatch binary invoked as "gm convert ...".
|
||||
// "-quiet" is dropped: it is not a GraphicsMagick option (GM is quiet by default).
|
||||
commandsAndArguments.put(".*",
|
||||
new String[]{exe, "${source}", "SPLIT:${options}", "-strip", "-quiet", "${target}"});
|
||||
new String[]{exe, "convert", "${source}", "SPLIT:${options}", "-strip", "${target}"});
|
||||
runtimeExec.setCommandsAndArguments(commandsAndArguments);
|
||||
|
||||
Map<String, String> processProperties = new HashMap<>();
|
||||
@@ -113,7 +115,8 @@ public class ImageMagickCommandExecutor extends AbstractCommandExecutor
|
||||
{
|
||||
RuntimeExec runtimeExec = new RuntimeExec();
|
||||
Map<String, String[]> commandsAndArguments = new HashMap<>();
|
||||
commandsAndArguments.put(".*", new String[]{exe, "-version"});
|
||||
// GraphicsMagick reports its version via "gm version" (not "gm -version").
|
||||
commandsAndArguments.put(".*", new String[]{exe, "version"});
|
||||
runtimeExec.setCommandsAndArguments(commandsAndArguments);
|
||||
return runtimeExec;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ queue:
|
||||
transform:
|
||||
core:
|
||||
imagemagick:
|
||||
root: ${IMAGEMAGICK_ROOT:/usr/lib64/ImageMagick-7.1.2}
|
||||
dyn: ${IMAGEMAGICK_DYN:/usr/lib64/ImageMagick-7.1.2/lib}
|
||||
exe: ${IMAGEMAGICK_EXE:/usr/bin/convert}
|
||||
root: ${IMAGEMAGICK_ROOT:/usr}
|
||||
dyn: ${IMAGEMAGICK_DYN:/usr/lib64}
|
||||
exe: ${IMAGEMAGICK_EXE:/usr/bin/gm}
|
||||
coders: ${IMAGEMAGICK_CODERS:}
|
||||
config: ${IMAGEMAGICK_CONFIG:}
|
||||
commandOptions:
|
||||
|
||||
+1
-1
@@ -240,7 +240,7 @@ public class ImageMagickTest extends AbstractBaseTest
|
||||
@Test
|
||||
public void optionsTest() throws Exception
|
||||
{
|
||||
expectedOptions = "-alpha remove -gravity SouthEast -crop 123x456%+90+12 +repage -thumbnail 321x654%!";
|
||||
expectedOptions = "-background white -flatten -gravity SouthEast -crop 123x456%+90+12 +repage -thumbnail 321x654%!";
|
||||
expectedSourceSuffix = "[2-3]";
|
||||
mockMvc
|
||||
.perform(MockMvcRequestBuilders
|
||||
|
||||
Reference in New Issue
Block a user