Bug 7977 - Some SVG images are incorrectly converted
Summary: Some SVG images are incorrectly converted
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
Depends on: 8059
Blocks: 7914
  Show dependency treegraph
 
Reported: 2022-08-09 14:36 CEST by Samuel Mannehed
Modified: 2022-12-28 15:49 CET (History)
0 users

See Also:
Acceptance Criteria:


Attachments

Description Samuel Mannehed cendio 2022-08-09 14:36:23 CEST
It seems we have a bug in how our ImageMagick's convert generates images. When using ImageMagick in cenbuild to generate the divider for the client installer, I instead get a completely white image. Furthermore, it's 20x10 in size instead of the requested 500x10:

> [14:00]	samuel@samuel: ~/devel/ctc-git/client/installer/images
> $ cbrun i386 make divider.bmp 
> convert -size 500x10 thinlinc_pattern.svg -crop 500x10+0+0 -depth 24 -channel RGB BMP3:divider.bmp
> 
> $ file divider.bmp 
> divider.bmp: PC bitmap, Windows 3.x format, 20 x 10 x 24, image size 600, resolution 35433 x 35433 px/m, cbSize 654, bits offset 54

Doing the same with a locally installed ImageMagick works:

> $ make divider.bmp 
> convert -size 500x10 thinlinc_pattern.svg -crop 500x10+0+0 -depth 24 -channel RGB BMP3:divider.bmp
> 
> $ file divider.bmp 
> divider.bmp: PC bitmap, Windows 3.x format, 500 x 10 x 24, image size 15000, resolution 3779 x 3779 px/m, cbSize 15054, bits offset 54

We have seen the same issue when generating a new background.png for the MacOS installer as well (bug 7976).
Comment 1 Samuel Mannehed cendio 2022-08-09 14:36:38 CEST
Note that ImageMagick in cenbuild is newer than on my Fedora 36:

> $ convert --version
> Version: ImageMagick 6.9.12-52 Q16 x86_64 17273 https://legacy.imagemagick.org
> Copyright: (C) 1999 ImageMagick Studio LLC
> License: https://imagemagick.org/script/license.php
> Features: Cipher DPC Modules OpenMP(4.5) 
> Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib
> 
> $ cbrun i386 convert --version
> Version: ImageMagick 7.0.8-14 Q16 i686 2020-01-17 https://imagemagick.org
> Copyright: © 1999-2018 ImageMagick Studio LLC
> License: https://imagemagick.org/script/license.php
> Features: Cipher DPC HDRI OpenMP 
> Delegates (built-in): bzlib cairo fontconfig freetype gvc jng jpeg png rsvg tiff xml zlib

Also note that librsvg is ancient in cenbuild:

> $ rpm -qa | grep librsvg
> cendio-build-librsvg-i386-2.26.0-10.noarch
> librsvg2-2.54.4-1.fc36.x86_64
Comment 2 Samuel Mannehed cendio 2022-08-09 14:43:42 CEST
Simply upgrading librsvg in cenbuild to the latest version won't be trivial it seems. Some requirements we don't fulfill at the moment:

 * rust compiler
 * cairo-1.16.0
 * gdk-pixbuf
 * GIO
 * gobject-introspection
 * gi-docgen
 * pango-1.46.0

See: https://gitlab.gnome.org/GNOME/librsvg/-/blob/main/COMPILING.md
Comment 3 Samuel Mannehed cendio 2022-08-09 14:47:19 CEST
It seems bug 7461 can be related. The workaround in that case, however, was to specify "-size" when calling 'convert'. That doesn't help here, unfortunately.
Comment 4 Samuel Mannehed cendio 2022-08-10 08:36:34 CEST
My hope is that upgrading librsvg will fix the issue.

librsvg 2.40.21 doesn't require rust, but still needs gobject-introspection which we don't have. The newest version that doesn't need gobject-introspection seems to be librsvg 2.32.1.
Comment 5 Samuel Mannehed cendio 2022-08-10 09:47:54 CEST
I tested ImageMagick on RHEL 7, which has IM 6.9 and librsvg 2.40, it works!

> $ convert thinlinc_pattern.svg -crop 500x10+0+0 -depth 24 -channel RGB BMP3:divider.bmp
>
> $ file divider.bmp 
> divider.bmp: PC bitmap, Windows 3.x format, 500 x 10 x 24
> 
> $ convert --version
> Version: ImageMagick 6.9.10-68 Q16 x86_64 2021-09-22 https://imagemagick.org
> Copyright: © 1999-2019 ImageMagick Studio LLC
> License: https://imagemagick.org/script/license.php
> Features: Cipher DPC Modules OpenMP(3.1) 
> Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff wmf x xml zlib
> 
> $ rpm -qa | grep librsvg
> librsvg2-2.40.20-1.el7.x86_64

As long as I don't specify -size...:

> $ convert -size 500x10 thinlinc_pattern.svg -crop 500x10+0+0 -depth 24 -channel RGB BMP3:divider.bmp
> 
> $ file divider.bmp 
> divider.bmp: PC bitmap, Windows 3.x format, 15 x 10 x 24

Note that this is the opposite of what we discovered in bug 7461, where we HAD to specify -size.. It seems this area is quite buggy in IM/librsvg.
Comment 6 Samuel Mannehed cendio 2022-08-10 10:38:26 CEST
Things work great on CentOS 6 with old versions of both IM and librsvg:

> $ convert thinlinc_pattern.svg -crop 500x10+0+0 -depth 24 -channel RGB BMP3:divider.bmp
> 
> $ file divider.bmp 
> divider.bmp: PC bitmap, Windows 3.x format, 500 x 10 x 24
> 
> $ convert -size 500x10 thinlinc_pattern.svg -crop 500x10+0+0 -depth 24 -channel RGB BMP3:divider.bmp
> 
> $ file divider.bmp 
> divider.bmp: PC bitmap, Windows 3.x format, 500 x 10 x 24
> 
> $ rpm -qa | grep librsvg
> librsvg2-2.26.0-14.el6.x86_64
> 
> $ convert --version
> Version: ImageMagick 6.7.2-7 2017-03-22 Q16 http://www.imagemagick.org
> Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
> Features: OpenMP
Comment 11 Samuel Mannehed cendio 2022-12-22 15:52:04 CET
Note we reported an issue with Fedora's packaging of ImageMagick here:

https://bugzilla.redhat.com/show_bug.cgi?id=2140018

Note You need to log in before you can comment on or make changes to this bug.