Skip to content

Pixie Trying to Parse SVG Viewbox as Int #29

Description

@Icosahunter

I have a test SVG image with non-integer viewbox size, and when trying to read this with pixie-python I get the following error:

strutils.nim(1072)       parseInt
invalid integer: 215.9

It seems to be trying to parse it as an integer, but I don't think that's necessarily a requirement for SVGs. I assume this is because it needs to have integer size for exporting to a raster image? In which case it should probably be rounded or something?

https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Attribute/viewBox

here's the full SVG that I was trying, in case that's helpful:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   width="8.5in"
   height="11in"
   viewBox="0 0 215.9 279.4"
   version="1.1"
   id="svg1"
   inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
   sodipodi:docname="red.svg"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <sodipodi:namedview
     id="namedview1"
     pagecolor="#ffffff"
     bordercolor="#000000"
     borderopacity="0.25"
     inkscape:showpageshadow="2"
     inkscape:pageopacity="0.0"
     inkscape:pagecheckerboard="0"
     inkscape:deskcolor="#d1d1d1"
     inkscape:document-units="mm"
     inkscape:zoom="0.51969075"
     inkscape:cx="343.4735"
     inkscape:cy="616.71293"
     inkscape:window-width="1920"
     inkscape:window-height="1012"
     inkscape:window-x="0"
     inkscape:window-y="0"
     inkscape:window-maximized="1"
     inkscape:current-layer="layer1" />
  <defs
     id="defs1" />
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1">
    <rect
       style="font-variation-settings:'wght' 700;fill:#ff0000;fill-opacity:1;stroke-width:6.88414;stroke-linejoin:round;stroke-dashoffset:21.1654;paint-order:markers fill stroke"
       id="rect1"
       width="215.89999"
       height="279.39999"
       x="0"
       y="0" />
  </g>
</svg>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions