Sharp: SVG convert to png Error [g_path_get_dirname: assertion 'file_name != NULL' failed]

Created on 24 Sep 2020  路  8Comments  路  Source: lovell/sharp

Hi All,

I am getting this error when trying to convert my svg file to png "(sharp:28256): GLib-CRITICAL **: 23:27:06.951: g_path_get_dirname: assertion 'file_name != NULL' failed"

Here's SVG Content

<g transform="matrix(1 0 0 1 193.5 207)" > <image style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" xlink:href="data:image/png;base64," x="-99.5" y="-75" width="199" height="150"></image> </g> <g transform="matrix(1 0 0 1 438.5 211)" > <image style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" xlink:href="data:image/png;base64," x="-99.5" y="-75" width="199" height="150"></image> </g>

Capture

sample.zip

blocked-upstream-dependency bug

Most helpful comment

It seems that gdk-pixbuf (the image loader used by librsvg) was trying find the directory of the /proc/self/exe symbolic link within the statically-linked libvips Windows binaries. The cause of this misbehavior was due to a backported patch from MSYS2.

I've fixed this bug with commit https://github.com/libvips/build-win64-mxe/commit/e5afa9d115bdfdf8f67c730445f3565247d4b652 on the build-win64-mxe repository and released it as v8.10.2-build2. Thanks for reporting this!

All 8 comments

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

What is the output of running npx envinfo --binaries --system?

@lovell I am having the same issue.

I am currently running the latest version of sharp. Running npm ls sharp gives me [email protected] and npm view sharp dist-tags.latest gives me 0.26.1.

Output of running: npx envinfo --binaries --system:

System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
    Memory: 3.83 GB / 15.94 GB
  Binaries:
    Node: 12.16.3 - D:\Program Files (x86)\Node\node.EXE
    npm: 6.14.4 - D:\Program Files (x86)\Node\npm.CMD

This error only occured to me, when I replaced my image url in xlink:href to the base64 data of my image and then converting the SVG to PNG.

The conversion is working tho - but just getting the mentioned warning/error.

I'm unable to reproduce this with the latest sharp using the supplied sample.svg and the following code:

sharp("sample.svg").toFile("out.png");

@ibrahimahmed-io Are you also using Windows?

@BE-CH Do you see the same error when you try the sample.svg from this issue?

Can anyone reproduce this on a non-Windows platform?

I just tried my exact same code on Linux. It is working perfectly fine there.

I will try to see if i can reproduce the error with the sample.svg on windows later.

Noticed the same "critical" warning within the latest libvips Windows binaries, see: https://ci.appveyor.com/project/lovell/sharp/builds/35718971/job/2tcmn8q2494ns25h#L847

I think it's safe to ignore this warning for now, but will investigate it further. A quick search for the g_path_get_dirname symbol in librsvg didn't yield any results.

It seems that gdk-pixbuf (the image loader used by librsvg) was trying find the directory of the /proc/self/exe symbolic link within the statically-linked libvips Windows binaries. The cause of this misbehavior was due to a backported patch from MSYS2.

I've fixed this bug with commit https://github.com/libvips/build-win64-mxe/commit/e5afa9d115bdfdf8f67c730445f3565247d4b652 on the build-win64-mxe repository and released it as v8.10.2-build2. Thanks for reporting this!

Thanks Kleis, top work as always.

sharp v0.27.0 now available with a prebuilt libvips v8.10.5 - thanks for reporting this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

henbenla picture henbenla  路  3Comments

janaz picture janaz  路  3Comments

terbooter picture terbooter  路  3Comments

natural-law picture natural-law  路  3Comments

emmtte picture emmtte  路  3Comments