godot: ImageLoaderSVG: Couldn't set target on ThorVG canvas.
Godot version
4.0.beta16
System information
Windows 10, Vulkan, NVIDIA GeForce GTX 1050
Issue description
Importing SVGβs from Kenney.NL fails with the following message:
ImageLoaderSVG: Couldn't set target on ThorVG canvas.
core/io/image_loader.cpp:101 - Error loading image: res://assets/icons/skull.svg
editor/editor_file_system.cpp:2004 - Error importing 'res://assets/icons/skull.svg'.
Steps to reproduce
- Grab icons from Kenney.NL here: https://www.kenney.nl/assets/board-game-icons
- Try importing an .svg from it
- The process will fail:

Minimal reproduction project
N/A
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 37 (21 by maintainers)
Commits related to this issue
- Fix tvg::Picture->size() based errors. In some cases, useful for the web canvas but not for an image viewer, the image size() returns here width or height zerro. Render 1x1 px placeholder image, See... — committed to capnm/godot4 by capnm a year ago
- Fix tvg::Picture->size() based errors. In some cases, useful for the web canvas but not for an image viewer, the image size() returns here width or height zerro. Render 1x1 px placeholder image, See... — committed to capnm/godot4 by capnm a year ago
- Fix tvg::Picture->size() based errors. In some cases, useful for the web canvas but not for an image viewer the tvg::Picture->size() returns here width or height zerro. Render a 1x1 px placeholder im... — committed to capnm/godot4 by capnm a year ago
- Fix tvg::Picture->size() based errors. In some cases, useful for the web canvas but not for an image viewer the tvg::Picture->size() returns here width or height zerro. Render a 1x1 px placeholder im... — committed to capnm/godot4 by capnm a year ago
- Test godot+thorvg git tip Issue: https://github.com/godotengine/godot/issues/72478 Also needs PR https://github.com/godotengine/godot/pull/75034 — committed to capnm/godot4 by capnm a year ago
- Update ThorVG to v0.9.0 https://github.com/thorvg/thorvg/releases/tag/v0.9.0 Fixes #72478 — committed to capnm/godot4 by capnm a year ago
- Update ThorVG to v0.9.0 https://github.com/thorvg/thorvg/releases/tag/v0.9.0 Fixes #72478 — committed to capnm/godot4 by capnm a year ago
- Update ThorVG to v0.9.0 https://github.com/thorvg/thorvg/releases/tag/v0.9.0 Fixes #72478 — committed to capnm/godot4 by capnm a year ago
- Update ThorVG to v0.9.0 https://github.com/thorvg/thorvg/releases/tag/v0.9.0 Fixes #72478 — committed to capnm/godot4 by capnm a year ago
- Update ThorVG to v0.9.0 https://github.com/thorvg/thorvg/releases/tag/v0.9.0 Fixes #72478 (cherry picked from commit 5db751832d54092c9d153c0fe07f9cc4616a2d01) — committed to akien-mga/godot by capnm a year ago
- Update ThorVG to v0.9.0 https://github.com/thorvg/thorvg/releases/tag/v0.9.0 Fixes #72478 — committed to hakro/godot by capnm a year ago
- Squashed commit of the following: commit 467eecb12bce4955fdb422aa2a171e45b94ae234 Author: Aaron Franke <arnfranke@yahoo.com> Date: Fri May 26 17:22:29 2023 -0500 Add a get_node_index method to... — committed to jeronimo-schreyer/godot by jeronimo-schreyer a year ago
- Squashed commit of the following: commit 467eecb12bce4955fdb422aa2a171e45b94ae234 Author: Aaron Franke <arnfranke@yahoo.com> Date: Fri May 26 17:22:29 2023 -0500 Add a get_node_index method to... — committed to jeronimo-schreyer/godot by jeronimo-schreyer a year ago
- Squashed commit of the following: commit 467eecb12bce4955fdb422aa2a171e45b94ae234 Author: Aaron Franke <arnfranke@yahoo.com> Date: Fri May 26 17:22:29 2023 -0500 Add a get_node_index method to... — committed to jeronimo-schreyer/godot by jeronimo-schreyer a year ago
- Update ThorVG to v0.9.0 https://github.com/thorvg/thorvg/releases/tag/v0.9.0 Fixes #72478 (cherry picked from commit 5db751832d54092c9d153c0fe07f9cc4616a2d01) — committed to haunted-loaf/godot by capnm a year ago
@mgrudzinska update: Both current godot 26fb911f79d7b16c46ca476923fe1f32ab5d27ed and thorvg 65116b87ada27689d79fa4db241cf777f3b268c5 github tip work together (the crash/dealock has been fixed). If the changes are in your next release, I donβt see any issues.
@mgrudzinska everything related to the image size and empty viewport/viewbox seems to be ok now. I have not yet received a response to #75034, I hope that one day it will be fixed too π
great, so Iβll take care now of this one extra pixel
@mgrudzinska
Most images show a picture π I didnβt examine if they are correct cropped. The 0 size is no longer a bug after this patch. It renders 1 pixel images in this case.
From all test images, I posted:
The 0 size cases are: <svg width=β0β> (the Gnome Image Viewer: whole picture) -> t8.svg <svg viewBox=β0 0 0 200β> (giv: 1 pixel) <svg viewBox=β0 0 200 0β> (giv: 1 pixel) <svg viewBox=β0 0 0 0β> (giv: 1 pixel) <svg width=β0β height=β0β viewBox=β0 0 200 200β> (giv: 1 pixel) <svg width=β0β height=β200β viewBox=β0 0 20 20β> (giv: 1 pixel) same: <svg width=β0β height=β200β viewBox=β0 0 200 200β> <svg width=β200β height=β0β viewBox=β0 0 20 20β>
This renders a transparent 200x200 sized images (giv: 200x200 cropped picture): <svg width=β200β height=β200β viewBox=β0 0 0 0β> <svg width=β200β height=β200β viewBox=β0 0 0 200β> <svg width=β200β height=β200β viewBox=β0 0 200 0β>
</detailsI missed this, Iβll solve this asap and let you know
@capnm Iβll try to make the pr ready asap - it is after rev and waiting for some changes.