Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a tool to create SVG paths from an SVG file? [closed]

does anyone know of a tool that can take an SVG file, and convert it into an HTML 5 SVG path? you know, the d="M 0 0 L 20 134 L 233 24 Z" fill="#99dd79" part?

I head here: Use Adobe Illustrator to create SVG Path using "move to" commands

But not sure. Does this mean Illustrator can take any line drwaing and save it as an SVG path?

Note: Yes there is inkscape, but I'm looking for gradient and masking support, if that's possible. I'd like to be able to utilize .ai files and export them using illustrator or Acrobat or something... is there something out there? Or is it built in to Illustrator or Acrobat as an output format?

like image 409
tim Avatar asked Jul 17 '12 19:07

tim


People also ask

Is it possible to draw any path in SVG?

The element in SVG is the ultimate drawing element. It can draw anything! I've heard that under the hood all the other drawing elements ultimately use path anyway. The path element takes a single attribute to describe what it draws: the d attribute.

Which of the following SVG path commands automatically closes a path?

The "closepath" command. The "closepath" (Z or z) ends the current subpath by connecting it back to its initial point. An automatic straight line is drawn from the current point to the initial point of the current subpath.

How do I get the SVG path in Inkscape?

As of Inkscape 1.0. 1 there is a preference under Edit > Preferences > Input/Output > SVG Output. For the Path data "Path string format", select "Relative". Then you need to modify your image position to trigger updating the paths to relative.


1 Answers

Gimp can be used to convert SVGs with primitives (e.g. rects, circles, etc.) into a single path which can be used within HTML5.

  1. First download Gimp: https://www.gimp.org/downloads/
  2. Export your SVG as a .svg file with any tool of choice e.g. Illustrator. Don't worry if the SVG output is messy for now, Gimp will clean it up
  3. Import the SVG file into Gimp with File -> Open, and the following (or similar) dialog should show up:

Gimp SVG Open Dialog

Check both the Import Paths and Merge imported paths options

  1. Then go to Windows->Dockable Dialogues->Paths
  2. Right-click on the single path which says Imported Path and you should see the following dialog:

enter image description here

  1. Click Export Path... and save this text file to a location of your choice
  2. Locate and open up this file with a text editor of your choice e.g Notepad, TextEdit
  3. Copy the text within the <path d="copy this text here" />
  4. Since Gimp formats the text with lots of spaces, you may need to re-format it, by removing some of the spaces to paste it into your HTML in a single line
like image 105
Jasdeep Khalsa Avatar answered Sep 18 '22 00:09

Jasdeep Khalsa