sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Missing elements in resulting image from svg

Open xDeda opened this issue 4 years ago • 3 comments

Trying to convert certain svg files (mouse.txt) but end up getting missing elements in the png:

expected: output:
mouse output
const sharp = require('sharp');
sharp('mouse.svg').toFile('output.png', (err, info) => { console.log(err, info) });

Weirdly, it's something different missing every time.. Might spend some time trying to figure out what sharp is skipping but wondering if there's a fix to this?

xDeda avatar Jun 05 '21 09:06 xDeda

The rsvg-convert command line tool produces the same output as sharp:

$ rsvg-convert mouse.svg > mouse.png

Please can you report this upstream at https://gitlab.gnome.org/GNOME/librsvg

lovell avatar Jun 10 '21 08:06 lovell

@xDeda Were you able to report this upstream at https://gitlab.gnome.org/GNOME/librsvg ? (I had a quick look but couldn't see a related issue.)

lovell avatar Jul 27 '22 11:07 lovell

@lovell ....no, sorry, I was being lazy back then...... but I might do some tests these days and see if I can replicate the issue and then write an issue :)

xDeda avatar Jul 27 '22 11:07 xDeda

@lovell I seem to just get a blank png when I run rsvg-convert and I'd love to report an issue upstream but it's so above my head trying to get and build all the software required to update to a more recent librsvg T_T you think it would be kosher to just post them my svg and ask what's up anyway? I get a blank png with rsvg-convert version 2.48.9

xDeda avatar Oct 18 '22 20:10 xDeda

A quick way to test the latest version is via an Alpine Edge container.

$ docker run -it --rm alpine:edge
/ # apk add rsvg-convert
fetch https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
...
OK: 34 MiB in 52 packages
/ # rsvg-convert -v
rsvg-convert version 2.55.1

lovell avatar Oct 19 '22 12:10 lovell

Reported upstream at https://gitlab.gnome.org/GNOME/librsvg/-/issues/912 sry for the delay

xDeda avatar Oct 19 '22 14:10 xDeda

Follow-up: it seems like they fixed this upstream: https://gitlab.gnome.org/federico/librsvg/-/commit/344d4c9f9d8b4efce6064d469b71266c25fd462b

xDeda avatar Dec 30 '22 23:12 xDeda

Thanks for the update. This was included in libsrvg v2.55.90 via commit https://gitlab.gnome.org/GNOME/librsvg/-/commit/344d4c9f9d8b4efce6064d469b71266c25fd462b and will be picked up by the prebuilt binaries provided by sharp from v0.32.0 onwards.

lovell avatar Dec 31 '22 10:12 lovell