I have this SVG file that contains a mask:
test.svg.zip
I convert it to PNG via sharp. Something very simple, like:
const image = await sharp('test.svg').toBuffer();
fs.writeFile('test.png', image, err => {
console.log(err);
});
And this results in wrong output in version 0.25.2 (the mask is cut off). This is a comparison:
0.24.1:

0.25.2:

I've tried a local test on my mac and node 12, and I cannot reproduce it. But in a Docker file built on top of node:12:12-alpine which I'm using to convert those images, I do see the cut off mask. I've tried running npx envinfo --binaries --system in that Docker image, but it just hangs (seems to be a known issue of npx).
Any ideas what causes this issue?
Hi, please can you provide the output of sharp.versions on the systems where it works vs where it doesn't.
Here you go:
sharp 24.1 on Docker node:12-alpine (works fine):
{
cairo: '1.16.0',
exif: '0.6.21',
expat: '2.2.9',
ffi: '3.3',
fontconfig: '2.13.92',
freetype: '2.10.1',
fribidi: '1.0.8',
gdkpixbuf: '2.40.0',
gettext: '0.20.1',
gif: '5.1.4',
glib: '2.63.3',
gsf: '1.14.46',
harfbuzz: '2.6.4',
jpeg: '2.0.4',
lcms: '2.9',
orc: '0.4.31',
pango: '1.44.7',
pixman: '0.38.4',
png: '1.6.37',
svg: '2.47.1',
tiff: '4.1.0',
vips: '8.9.0',
webp: '1.1.0',
xml: '2.9.10',
zlib: '1.2.11'
}
sharp 25.2 on macOS 10.15.4 (works fine)
{
cairo: '1.16.0',
croco: '0.6.13',
exif: '0.6.21',
fontconfig: '2.13.1',
freetype: '23.1.17',
fribidi: '1.0.8',
gdkpixbuf: '2.40.0',
gif: '5.2.1',
glib: '2.64.0',
gsf: '1.14.46',
harfbuzz: '2.6.4',
jpeg: '2.0.4',
lcms: '2.9',
orc: '0.4.31',
pango: '1.44.7',
pixman: '0.38.4',
png: '1.6.37',
svg: '2.46.4',
tiff: '4.1.0',
vips: '8.9.1',
webp: '1.1.0',
xml: '2.9.4'
}
sharp 25.2 on Docker node:12-alpine (has bug)
{
cairo: '1.16.0',
exif: '0.6.21',
expat: '2.2.9',
ffi: '3.3',
fontconfig: '2.13.92',
freetype: '2.10.1',
fribidi: '1.0.9',
gdkpixbuf: '2.40.0',
gettext: '0.20.1',
gif: '5.1.4',
glib: '2.64.0',
gsf: '1.14.46',
harfbuzz: '2.6.4',
jpeg: '2.0.4',
lcms: '2.9',
orc: '0.4.31',
pango: '1.44.7',
pixman: '0.38.4',
png: '1.6.37',
svg: '2.48.0',
tiff: '4.1.0',
vips: '8.9.1',
webp: '1.1.0',
xml: '2.9.10',
zlib: '1.2.11'
}
Looks like this has just been reported upstream at https://gitlab.gnome.org/GNOME/librsvg/-/issues/590.
librsvg 2.48.4 is now available, which should fix this.
v0.26.0 now available with prebuilt binaries containing the upstream fix.
Most helpful comment
Looks like this has just been reported upstream at https://gitlab.gnome.org/GNOME/librsvg/-/issues/590.