Giter VIP home page Giter VIP logo

svgo-inkscape's Issues

Windows installation instructions need correction

The instructions for installation on Windows are incorrect in a few points:

  1. You should not extract the archive as stated in the instructions, since it contains a root folder svgo-inkscape-windows64. The contents of this folder need to be extracted (that is the sub-folder named svgo-inkscape and a file named svgo-inkscape.inx).
  2. The target folder is not C:\Program Files\Inkscape\share\extensions as stated but C:\Program Files\Inkscape\share\inkscape\extensions\

I'm using the current release v1.0.1 and Inkscape at v1.1.1

Issue saving on Windows

I have an issue saving an optimized SVG in InkScape on Windows:

  File "svgo.inkscape.py", line 75, in <module>
    e.affect(output=False)
  File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 283, in affect
    self.effect()
  File "svgo.inkscape.py", line 70, in effect
    sys.stdout.write(result.encode("UTF-8"))
TypeError: write() argument must be str, not bytes

Text element with UTF-8 can't be saved

Text element with unicode can't be saved:

Traceback (most recent call last):
File "svgo.inkscape.py", line 75, in
e.affect(output=False)
File "D:\0syncedSSD\Portable Progs\InkscapePortable x64\App\Inkscape\share\extensions\inkex.py", line 268, in affect
self.effect()
File "svgo.inkscape.py", line 70, in effect
sys.stdout.write(result.encode("UTF-8"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 128197: ordinal not in range(128)

0xC3 is the beginning of UTF-8 codepoint \xC3\x97 (this character: ×)

InkScape Save as -> Optimized with svgo (*.svg) unable to save file

I followed the instruction from here to install svgo-inkscape extension. The extension now appears in InkSCape's Save as dialog. But when I try to save the following file as Optimized with svgo (*.svg), I get the following error:

Error: MyFile.svg could not be saved

Question: What could be a cause of the error and how can we resolve it?

MyFile.svg:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:ns7="http://www.iki.fi/pav/software/textext/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="210mm"
   height="297mm"
   viewBox="0 0 210 297"
   version="1.1"
   id="svg943"
   sodipodi:docname="Sqrt_test.svg"
   inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
  <defs
     id="defs937" />
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.35"
     inkscape:cx="400"
     inkscape:cy="560"
     inkscape:document-units="mm"
     inkscape:current-layer="layer1"
     inkscape:document-rotation="0"
     showgrid="false"
     inkscape:window-width="1267"
     inkscape:window-height="728"
     inkscape:window-x="52"
     inkscape:window-y="0"
     inkscape:window-maximized="0" />
  <metadata
     id="metadata940">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title />
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1">
    <g
       transform="matrix(2.9928619,0,0,2.9928619,-0.00112232,7.4821546e-4)"
       ns7:version="1.3.1"
       ns7:texconverter="pdflatex"
       ns7:pdfconverter="inkscape"
       ns7:text="\\[\\sqrt{x}\\]"
       ns7:preamble="C:\Users\RazLT3user\AppData\Roaming\inkscape\extensions\textext\default_packages.tex"
       ns7:scale="1.0"
       ns7:alignment="middle center"
       ns7:jacobian_sqrt="0.352778"
       id="g968">
      <defs
         id="id-fc1fb31e-80f7-41f7-944b-33a65b0c7953">
        <g
           id="id-c8abbc90-a208-4fd6-944d-b6b284bb753c">
          <symbol
             overflow="visible"
             id="id-5b127d2a-bd8a-484e-bd28-d12d0ac986e4">
            <path
               style="stroke:none;stroke-width:0"
               d=""
               id="id-8de2a455-f0b9-4396-9705-713697487c12" />
          </symbol>
          <symbol
             overflow="visible"
             id="id-8ebb50fe-7ed3-46fe-9755-38b6c641e90a">
            <path
               style="stroke:none;stroke-width:0"
               d="m 3.875,8.515625 -1.75,-3.875 C 2.046875,4.484375 2,4.484375 1.96875,4.484375 c 0,0 -0.0625,0 -0.171875,0.078125 l -0.9375,0.71875 c -0.125,0.109375 -0.125,0.125 -0.125,0.15625 0,0.0625 0.015625,0.109375 0.09375,0.109375 0.0625,0 0.234375,-0.140625 0.34375,-0.21875 C 1.21875,5.28125 1.375,5.171875 1.484375,5.09375 l 1.96875,4.3125 C 3.515625,9.5625 3.5625,9.5625 3.65625,9.5625 c 0.15625,0 0.1875,-0.046875 0.25,-0.1875 L 8.4375,0 C 8.5,-0.140625 8.5,-0.171875 8.5,-0.203125 8.5,-0.296875 8.421875,-0.40625 8.296875,-0.40625 c -0.078125,0 -0.140625,0.0625 -0.21875,0.21875 z m 0,0"
               id="id-591c447f-2911-49df-a851-2e3a6680e422" />
          </symbol>
          <symbol
             overflow="visible"
             id="id-bfdb2a50-dbf2-4c28-a53b-887de8101e98">
            <path
               style="stroke:none;stroke-width:0"
               d=""
               id="id-98253d78-2ab0-4e20-8805-4adad34a7607" />
          </symbol>
          <symbol
             overflow="visible"
             id="id-74c2ea4b-0fa0-400f-bcf3-77fa5a7ab16b">
            <path
               style="stroke:none;stroke-width:0"
               d="M 3.328125,-3.015625 C 3.390625,-3.265625 3.625,-4.1875 4.3125,-4.1875 c 0.046875,0 0.296875,0 0.5,0.125 C 4.53125,-4 4.34375,-3.765625 4.34375,-3.515625 c 0,0.15625 0.109375,0.34375 0.375,0.34375 0.21875,0 0.53125,-0.171875 0.53125,-0.578125 0,-0.515625 -0.578125,-0.65625 -0.921875,-0.65625 -0.578125,0 -0.921875,0.53125 -1.046875,0.75 -0.25,-0.65625 -0.78125,-0.75 -1.078125,-0.75 -1.03125,0 -1.609375,1.28125 -1.609375,1.53125 0,0.109375 0.109375,0.109375 0.125,0.109375 0.078125,0 0.109375,-0.03125 0.125,-0.109375 0.34375,-1.0625 1,-1.3125 1.34375,-1.3125 0.1875,0 0.53125,0.09375 0.53125,0.671875 0,0.3125 -0.171875,0.96875 -0.53125,2.375 -0.15625,0.609375 -0.515625,1.03125 -0.953125,1.03125 -0.0625,0 -0.28125,0 -0.5,-0.125 0.25,-0.0625 0.46875,-0.265625 0.46875,-0.546875 0,-0.265625 -0.21875,-0.34375 -0.359375,-0.34375 -0.3125,0 -0.546875,0.25 -0.546875,0.578125 0,0.453125 0.484375,0.65625 0.921875,0.65625 0.671875,0 1.03125,-0.703125 1.046875,-0.75 0.125,0.359375 0.484375,0.75 1.078125,0.75 1.03125,0 1.59375,-1.28125 1.59375,-1.53125 0,-0.109375 -0.078125,-0.109375 -0.109375,-0.109375 -0.09375,0 -0.109375,0.046875 -0.140625,0.109375 -0.328125,1.078125 -1,1.3125 -1.3125,1.3125 -0.390625,0 -0.546875,-0.3125 -0.546875,-0.65625 0,-0.21875 0.046875,-0.4375 0.15625,-0.875 z m 0,0"
               id="id-4da64eab-9ea5-47aa-8b15-87988bff3f4f" />
          </symbol>
        </g>
      </defs>
      <g
         id="id-92fb6d2b-2d4a-47c5-9c8e-04c4ede4b8ba"
         transform="translate(-299.36,-138.652)">
        <g
           style="fill:#000000;fill-opacity:1"
           id="id-09d1d91a-cd32-4274-8160-ae109a739c57">
          <g
             transform="translate(298.626,139.058)"
             id="g959">
            <path
               style="stroke:none;stroke-width:0"
               d="m 3.875,8.515625 -1.75,-3.875 C 2.046875,4.484375 2,4.484375 1.96875,4.484375 c 0,0 -0.0625,0 -0.171875,0.078125 l -0.9375,0.71875 c -0.125,0.109375 -0.125,0.125 -0.125,0.15625 0,0.0625 0.015625,0.109375 0.09375,0.109375 0.0625,0 0.234375,-0.140625 0.34375,-0.21875 C 1.21875,5.28125 1.375,5.171875 1.484375,5.09375 l 1.96875,4.3125 C 3.515625,9.5625 3.5625,9.5625 3.65625,9.5625 c 0.15625,0 0.1875,-0.046875 0.25,-0.1875 L 8.4375,0 C 8.5,-0.140625 8.5,-0.171875 8.5,-0.203125 8.5,-0.296875 8.421875,-0.40625 8.296875,-0.40625 c -0.078125,0 -0.140625,0.0625 -0.21875,0.21875 z m 0,0"
               id="id-87e9bbd4-e59e-414c-bd10-a3ec5e2104f3" />
          </g>
        </g>
        <path
           style="fill:none;stroke:#000000;stroke-width:0.398;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1"
           d="M 0.0016875,-0.001375 H 5.693094"
           transform="matrix(1,0,0,-1,306.928,138.858)"
           id="id-533ba1fa-39e6-4f95-b4db-9db22a7489a0" />
        <g
           style="fill:#000000;fill-opacity:1"
           id="id-3640a48e-8fc4-4219-a6f2-d729cf8ad007">
          <g
             transform="translate(306.928,146.72)"
             id="g964">
            <path
               style="stroke:none;stroke-width:0"
               d="M 3.328125,-3.015625 C 3.390625,-3.265625 3.625,-4.1875 4.3125,-4.1875 c 0.046875,0 0.296875,0 0.5,0.125 C 4.53125,-4 4.34375,-3.765625 4.34375,-3.515625 c 0,0.15625 0.109375,0.34375 0.375,0.34375 0.21875,0 0.53125,-0.171875 0.53125,-0.578125 0,-0.515625 -0.578125,-0.65625 -0.921875,-0.65625 -0.578125,0 -0.921875,0.53125 -1.046875,0.75 -0.25,-0.65625 -0.78125,-0.75 -1.078125,-0.75 -1.03125,0 -1.609375,1.28125 -1.609375,1.53125 0,0.109375 0.109375,0.109375 0.125,0.109375 0.078125,0 0.109375,-0.03125 0.125,-0.109375 0.34375,-1.0625 1,-1.3125 1.34375,-1.3125 0.1875,0 0.53125,0.09375 0.53125,0.671875 0,0.3125 -0.171875,0.96875 -0.53125,2.375 -0.15625,0.609375 -0.515625,1.03125 -0.953125,1.03125 -0.0625,0 -0.28125,0 -0.5,-0.125 0.25,-0.0625 0.46875,-0.265625 0.46875,-0.546875 0,-0.265625 -0.21875,-0.34375 -0.359375,-0.34375 -0.3125,0 -0.546875,0.25 -0.546875,0.578125 0,0.453125 0.484375,0.65625 0.921875,0.65625 0.671875,0 1.03125,-0.703125 1.046875,-0.75 0.125,0.359375 0.484375,0.75 1.078125,0.75 1.03125,0 1.59375,-1.28125 1.59375,-1.53125 0,-0.109375 -0.078125,-0.109375 -0.109375,-0.109375 -0.09375,0 -0.109375,0.046875 -0.140625,0.109375 -0.328125,1.078125 -1,1.3125 -1.3125,1.3125 -0.390625,0 -0.546875,-0.3125 -0.546875,-0.65625 0,-0.21875 0.046875,-0.4375 0.15625,-0.875 z m 0,0"
               id="id-8f1254a8-794d-440e-b4cc-a4fbf35e97bd" />
          </g>
        </g>
      </g>
    </g>
  </g>
</svg>

Display of the above MyFile.svg:

enter image description here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.