Need to batch convert svg to png? I have a few thousand .svg files that I need to convert to raster, namely .png. I ended up using ImageMagick. Apparently it is the standard tool to use. However, Inkscape and Apache Batik are also capable of converting svg to a raster format.
ImageMagick has a convert tool and a mogrify tool which can convert svg to png.
What I want to do is covert my few thousand .svg files to .png files using the same file name as the .svg files, only with the .png extension.
For some reason, I couln’t do that with the convert command. All of the output files needed to have part of the file name given, so that numbers could be appended to it, or a full file name given, in which case only one output file was created.
I poked around a bit and discovered the mogrify command would use the input file names to create the output file names, only with the .png extension instead of the .svg extension. I also needed the .png files to be a certain size, which mogrify also allows.
Here is the command I used:
mogrify -resize widthxheight -format png *.svg
where width is the desired width of the .png, ex: 100, and height is the desired height of the .png, ex: 100.
Worked great and I now have my batch of .svg files converted to .png files in the size I need.
More Apache Batik
So I downloaded the latest .45 pre-release version of Inkscape, so I could check out the pattern along path option. Drop down options in dialog box are empty, do some searching & turns out you’ll need to edit pathalongpath.inx in the share/extensions subdirectory of your installation directory. Change all _item values to item and restart Inkscape if running. Voila, options. Played around a bit, seems to do what I need. Looks like the source code to do it is included in the download in pathalongpath.py. It’s a python script. Took a look. Hard to decode, but looks like it’s doing what I thought you’d need to do. Divide the path into small pieces, rotate, translate your symbol along the path. The key part, use a group for the symbol, which is what these 3rd party svg’s I have use. I think I can do it, but I need to play around a little more.
The latest version of the svg graphics editor, Sketsa 4.0 has been released. I’ve got the old version. It’s a good tool, but you need java 1.5 in order to install it.
Apparently the new version of Inkscape, .45, has a menu option to draw a pattern along a path. Exactly what I’ve been trying to do, except I need to be able to code it. There is a pre-release version of .45 available, so I’m going to download it & maybe I can figure out how they are doing it. I’ve kind of got an idea of how to do it, but I’m hoping there’s an easier way.
Am looking forward to CNET’s Wireless Basics course. Hopefully I’ll learn how to share files between my laptop and desktop using the wiflyer. Right now I’m taking a pc gaming course. Pretty interesting. Here are a couple of useful sites which check to see how good your computer system is for gaming: Gamespot and Futuremark.
Remember, these courses are free, except for your time. There are a variety of courses. They are not the most in depth, but do contain useful info.