Ludii Forum
Can't load SVG - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About Ludii (https://ludii.games/forums/forumdisplay.php?fid=14)
+--- Thread: Can't load SVG (/showthread.php?tid=269)

Pages: 1 2


Can't load SVG - slimy_asparagus - 11-20-2020

I cannot get the svg to load. It is just loading the letter "A". I attach a test file. The forum will not allow me to upload an SVG so here is a link: https://www.dropbox.com/s/9vo1sql323hllye/HeadOrtho.svg?dl=0 .


RE: Can't load SVG - MatthewStephenson - 11-20-2020

Hi,

SVGs can currently only be loaded from the included set of images within Ludii.
However I've added the ability to load external SVGs as well. To use an external SVG (like the one you want to use), simply include them in the same location as the Ludii preferences file (i.e. the current working directory/folder).
This functionality will be included in the next release.

I have also updated the forum to allow SVG files to be uploaded in the future Smile

Cheers,
Matthew


RE: Can't load SVG - slimy_asparagus - 11-20-2020

(11-20-2020, 09:21 PM)MatthewStephenson Wrote: Hi,

SVGs can currently only be loaded from the included set of images within Ludii.
However I've added the ability to load external SVGs as well. To use an external SVG (like the one you want to use), simply include them in the same location as the Ludii jar file.

This functionality will be included in the next release.

I have also updated the forum to allow SVG files to be uploaded in the future :)

Cheers,
Matthew

Okay thanks. Now I really am looking forward to the next release. I am surprised Ludii has got this far without support for custom images.

I imagine someone might want some control over the location of the images.


RE: Can't load SVG - MatthewStephenson - 11-20-2020

Hi,


Quote:I imagine someone might want some control over the location of the images.


Good point. You will also be able to specify this within the image name.
For example, if you placed your image within a folder called "heads", you would just need to change your metadata line to:
(piece Foreground "HeadOrtho" image:"heads/HeadOrtho")

Cheers,
Matthew


RE: Can't load SVG - MatthewStephenson - 11-21-2020

Hi,

One thing to point out, is that we have several limitations on what SVG images can be used within Ludii.
Currently your SVG image is reflected in Ludii.
The best way to check if an SVG will display correctly in Ludii, is using the "View -> Load SVG" menu option.

The current restrictions on SVGs in Ludii are:
- Colour is not used (we fill the figure with player colour then draw black border).
- Figure border must be defined by a path fill (not a stroke).
- Can use multiple paths, but no other primitive shapes (no lines, not rectangles, no circles, ...)
- Can't use transforms (which is why your example image from yesterday is reflected).
- Groups are not respected (though do not necessarily draw badly).

Cheers,
Matthew


RE: Can't load SVG - slimy_asparagus - 11-21-2020

(11-21-2020, 09:57 AM)MatthewStephenson Wrote: Hi,

One thing to point out, is that we have several limitations on what SVG images can be used within Ludii.
Currently your SVG image is reflected in Ludii.
The best way to check if an SVG will display correctly in Ludii, is using the "View -> Load SVG" menu option.

The current restrictions on SVGs in Ludii are:
- Colour is not used (we fill the figure with player colour then draw black border).
- Figure border must be defined by a path fill (not a stroke).
- Can use multiple paths, but no other primitive shapes (no lines, not rectangles, no circles, ...)
- Can't use transforms (which is why your example image from yesterday is reflected).
- Groups are not respected (though do not necessarily draw badly).

Cheers,
Matthew

Thanks for the info. I am fairly new to SVG. I may have to research that a bit.


RE: Can't load SVG - slimy_asparagus - 11-30-2020

(11-21-2020, 09:57 AM)MatthewStephenson Wrote: Hi,

One thing to point out, is that we have several limitations on what SVG images can be used within Ludii.
Currently your SVG image is reflected in Ludii.
The best way to check if an SVG will display correctly in Ludii, is using the "View -> Load SVG" menu option.

The current restrictions on SVGs in Ludii are:
- Colour is not used (we fill the figure with player colour then draw black border).
- Figure border must be defined by a path fill (not a stroke).
- Can use multiple paths, but no other primitive shapes (no lines, not rectangles, no circles, ...)
- Can't use transforms (which is why your example image from yesterday is reflected).
- Groups are not respected (though do not necessarily draw badly).

Cheers,
Matthew

Matthew,

I am somewhat struggling with this.

As far as I can see Inkscape ignores your criteria fairly blindly. However I have never used this program before and I don't really know what I am doing.

I have managed to get something that looks to me like it should work. I managed (inside GIMP) convert a selection to a path and exported that to an SVG. I then tweaked a few parameters in the text and it seems to look right to me. However when I test it in Ludii using "Load SVG" nothing happens.

I did manage to load something from what I produced using inkscape but that was a horrible mess.

Please could you give any clues on how I can generate compliant SVG's?

Nicholas


RE: Can't load SVG - cambolbro - 11-30-2020

Hi,

The problem was this text:

id="Selection"
fill="black" stroke="none" stroke-width="1"

Remove this text and it should work (it works for me anyway). Our custom SVG code really doesn't like anything except path data in its <path ...> elements!

Note that we might be overhauling the internal SVG handling soon, in preparation for a web browser version of Ludii, so SVG support might be better soon if you can wait.

Regards,
Cameron


RE: Can't load SVG - slimy_asparagus - 11-30-2020

(11-30-2020, 04:52 PM)cambolbro Wrote: Hi,

The problem was this text:

      id="Selection"
      fill="black" stroke="none" stroke-width="1"

Remove this text and it should work (it works for me anyway). Our custom SVG code really doesn't like anything except path data in its <path ...> elements!

Note that we might be overhauling the internal SVG handling soon, in preparation for a web browser version of Ludii, so SVG support might be better soon if you can wait.

Regards,
Cameron
Cameron,


Thanks that works for me too.

Nicholas


RE: Can't load SVG - sharmoni - 11-17-2021

(11-20-2020, 09:21 PM)MatthewStephenson Wrote: Hi,

SVGs can currently only be loaded from the included set of images within Ludii.
However I've added the ability to load external SVGs as well. To use an external SVG (like the one you want to use), simply include them in the same location as the Ludii preferences file (i.e. the current working directory/folder).
This functionality will be included in the next release.

I have also updated the forum to allow SVG files to be uploaded in the future :)

Cheers,
Matthew

Was this feature implemented? I'm trying to test my own isometric svgs (which work in the loader—so the svgs are valid) but can't get them to work when I put them in the folder with the preferences file (either loose or in a folder). I'm using Mac OS 10.13.6