WMF to SVG using uniconverter

Share your Inkscape tricks and tutorials here.
CutNGlass
Posts: 3
Joined: Mon Oct 10, 2011 10:21 pm

WMF to SVG using uniconverter

Postby CutNGlass » Tue Oct 11, 2011 1:49 am

Since we got warnings regarding "depricated versions" from the uniconverter in the debian linux repository, we went searching for it elsewhere. We found a great spot for downloading it from. Many linux distros / hardware variations to choose from:

http://sk1project.org/modules.php?name= ... p=download

we didn't bother with the uniconvw, as there are too many issues regarding gtk, gnome, etc. not quite ready for prime time. And since we don't really need to gui, we opted for the command-line uniconverter.

We just downloaded the sk1libs and their pre-compiled version for debian.

With a couple of quick scripts, we were able to get rid of those annoying spaces (wmf/windows) :roll:

/****************************************************************************************************/
/* Actually, my :ugeek: hubby put these together, while I ran errands yesterday
/****************************************************************************************************/
/* all i had to do was copy the wmf's into separate directories ...
/* run script to strip out spaces (changes to underscore) (also changes to all lower case)
/* run script to convert wmf's to svg's
/* ta da!
/* woo hoo ... yeah for my hubby! ...
/* now, i can play with the svg's in Inkscape!
/****************************************************************************************************/
/* note: if there are other files in directory with the wmf's you will get warnings
/* i'd suggest putting them in special "conversion" or "temp" directory before running
/* feel free to make improvements, but this was so helpful to me
/* that i felt i just had to share them "as is"
/****************************************************************************************************/
/* these are marked as "bash" scripts, you would need to change those to whatever
/* shell you are using
/* don't forget to change file permissions to "execute"
/****************************************************************************************************/
Anyhow, here are the scripts which automate the conversion process:

--one strips out spaces (replacing with underscores)
--the other one converts all wmf's within a directory to svg's (using uniconverter)

this one we named rm_spaces.sh:
#!/bin/bash
# Replace spaces with underscores in the file names
# (change to any char you want) and convert upper to lower case.
#
# To execute:
# (1) Change to directory with the files you want to change
# (2) In terminal: ./rm_spaces.sh
#
for f in *; do
file=$(echo $f | tr A-Z a-z | tr ' ' _)
[ ! -f $file ] && mv "$f" $file
done


this we have named wmf2svg_convert_script.sh:
#!/bin/bash
# batch conversion script to run uniconverter
# to convert wmf files to svg format
#
#
# To execute:
# (1) Change to directory with the files you want to change
# (2) In terminal: ./wmf2svg_convert_script.sh
#
or f in *; do
lcfile=`echo $f | cut -d '.' -f1`
uniconvertor "$f" $lcfile".svg"
done

Return to “Tricks & Tutorials”