[packages/ImageMagick] Rel 2. Fix autotrace SVG writer: call autotrace_init() (0-byte output) and scale Q16 samples to 8 bi
arekm
arekm at pld-linux.org
Thu Oct 15 21:52:10 CEST 2026
commit 87ae0deddb8963e457d57ca7263e717d2273c6ca
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Oct 15 21:50:21 2026 +0200
Rel 2. Fix autotrace SVG writer: call autotrace_init() (0-byte output) and scale Q16 samples to 8 bits
ImageMagick-autotrace-init.patch | 11 +++++++++++
ImageMagick-autotrace-quantum.patch | 18 ++++++++++++++++++
ImageMagick.spec | 6 +++++-
3 files changed, 34 insertions(+), 1 deletion(-)
---
diff --git a/ImageMagick.spec b/ImageMagick.spec
index 73e19fb..526ff9c 100644
--- a/ImageMagick.spec
+++ b/ImageMagick.spec
@@ -41,7 +41,7 @@ Summary(tr.UTF-8): X altında resim gösterme, çevirme ve değişiklik yapma
Summary(uk.UTF-8): Перегляд, конвертування та обробка зображень під X Window
Name: ImageMagick
Version: %{ver}%{?pver:.%{pver}}
-Release: 1
+Release: 2
Epoch: 1
License: Apache-like
Group: X11/Applications/Graphics
@@ -52,6 +52,8 @@ Patch2: %{name}-libpath.patch
Patch3: %{name}-ldflags.patch
Patch4: %{name}-lt.patch
Patch5: %{name}-OpenCL.patch
+Patch6: %{name}-autotrace-init.patch
+Patch7: %{name}-autotrace-quantum.patch
URL: https://imagemagick.org/
%{?with_opencl:BuildRequires: OpenCL-devel}
%{?with_exr:BuildRequires: OpenEXR-devel >= 1.0.6}
@@ -769,6 +771,8 @@ Moduł kodera dla plików WMF.
%patch -P3 -p1
%patch -P4 -p1
%patch -P5 -p1
+%patch -P6 -p1
+%patch -P7 -p1
find -type f | xargs grep -l '/usr/local/bin/perl' | xargs %{__sed} -i -e 's=!/usr/local/bin/perl=!%{__perl}='
diff --git a/ImageMagick-autotrace-init.patch b/ImageMagick-autotrace-init.patch
new file mode 100644
index 0000000..5993299
--- /dev/null
+++ b/ImageMagick-autotrace-init.patch
@@ -0,0 +1,11 @@
+# autotrace registers its output writers only in autotrace_init(); without it the svg handler lookup fails and a 0-byte file is written
+--- ImageMagick-7.1.2-34/coders/svg.c.orig
++++ ImageMagick-7.1.2-34/coders/svg.c
+@@ -3705,6 +3705,7 @@
+ /*
+ Trace image and write as SVG.
+ */
++ autotrace_init();
+ fitting_options=at_fitting_opts_new();
+ output_options=at_output_opts_new();
+ number_planes=3;
diff --git a/ImageMagick-autotrace-quantum.patch b/ImageMagick-autotrace-quantum.patch
new file mode 100644
index 0000000..e22aca6
--- /dev/null
+++ b/ImageMagick-autotrace-quantum.patch
@@ -0,0 +1,18 @@
+# at_bitmap holds 8-bit samples; storing a raw Q16 Quantum keeps only its low byte
+--- ImageMagick-7.1.2-34/coders/svg.c.orig
++++ ImageMagick-7.1.2-34/coders/svg.c
+@@ -3720,11 +3720,11 @@
+ break;
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+- trace->bitmap[i++]=GetPixelRed(image,p);
++ trace->bitmap[i++]=ScaleQuantumToChar(GetPixelRed(image,p));
+ if (number_planes == 3)
+ {
+- trace->bitmap[i++]=GetPixelGreen(image,p);
+- trace->bitmap[i++]=GetPixelBlue(image,p);
++ trace->bitmap[i++]=ScaleQuantumToChar(GetPixelGreen(image,p));
++ trace->bitmap[i++]=ScaleQuantumToChar(GetPixelBlue(image,p));
+ }
+ p+=(ptrdiff_t) GetPixelChannels(image);
+ }
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/ImageMagick.git/commitdiff/87ae0deddb8963e457d57ca7263e717d2273c6ca
More information about the pld-cvs-commit
mailing list