Last edit

Summary: extensions directory on a Mac


> [new:TedErnst:2006-11-12 03:36 UTC] It seems I didn't actually check the wiki to see if the image was uploaded before I posted my report about the error. In spite of the error, the image was uploaded as updated. Hmm. Thanks, Alex!

This Inkscape extension makes it easy to edit InkScape images on an OddMuse wiki. It automatically writes both SVG and PNG images, and it integrates with the Save dialog.

This is an example of a ContentRouting tool and cuts down dramatically on the LongImageIncorporationProcess, and take out a ton of the drudgery of making VisualLanguage for an Oddmuse wiki.


  1. Get the latest oddmuse-inkscape tarball from http://download.savannah.gnu.org/releases/oddmuse/.
  2. Unpack the archive and move all the files (except for the GPL license) into your Inkscape extensions directory.

Check for the Inkscape extensions directory in the following places:

  1. /usr/share/inkscape/extensions
  2. /Applications/Inkscape.app/Contents/Resources/extensions/


  1. Create a working directory for the wiki you want to work with, eg. ~/Documents/CommunityWiki.
  2. In that directory, create a file called notes.txt.
  3. On the first line of that file write “username” and your username, eg. “username LionKimbro”.
  4. On the second line of that file write “urlbase” and the base URL of the wiki, eg. “urlbase http://www.communitywiki.org/cw/
  5. For every image you want to edit, create a matching, empty ODD file as follows: If the page on the wiki is called FooBarImage or FooBarSource, create FooBar.odd in your working directory.
  6. Open Inkscape.
  7. In the Open File dialog, choose the file type “Oddmuse Wiki GET (*.odd)” and pick one of the empty ODD files. This will download the appropriate SVG file from the wiki and let you edit it.
  8. In the Save File dialog, choose the file type “Oddmuse Wiki POST (*.odd)” and pick the same ODD file you opened. This will upload the current SVG and PNG files to the wiki.

Example notes.txt file:

username LionKimbro
urlbase http://www.communitywiki.org/cw/

The working directory containing this notes.txt file now represents the wiki.

Here’s how to recreate the above example on the command-line:

mkdir -p ~/Documents/CommunityWiki
echo "username LionKimbro" > ~/Documents/CommunityWiki/notes.txt
echo "urlbase http://www.communitywiki.org/cw/" >> ~/Documents/CommunityWiki/notes.txt


Verifying Your Setup

1.) Check that you have the following files in the extensions folder:

2.) Check that you have a properly formatted notes.txt file in the folder you saved to.

It should have “username” and “urlbase” set, something like so:

username LionKimbro
urlbase http://www.communitywiki.org/cw/

3.) Check the ODD file for any errors. Open it in a text editor. If the upload fails, usually there will be a message for you at the top of this file.

4.) Check that in the directory you made, that there are “.svg” and “.png” versions of your file.

If there are not, somehow it’s not finding your directory, or something like that.

Are you sure you saved to the right directory?

5.) Check that you posted a question below.

That is: If it’s not working, put a note here. :)

Common Errors

If you get an error message saying 415 UNSUPPORTED MEDIA TYPE, then you have a problem with your MIME types. The administrator of the wiki probably restricted the types allowed for uploading. The standard MIME type for SVG files should be image/svg+xml.

Thus, you need to make sure that SVG files are associated with the image/svg+xml type on your system. Edit the /etc/mime.types file and make sure that the following entry is listed:

image/svg+xml                   svg

How it Works


Automatically Creating ODD Files

Save this file, call it “scan.sh”. Put a copy of it in your wiki directory.

Make sure you have a notes.txt file in there, as described on InkscapeToOddmuse.

 # Scan Oddmuse for SVG.
 # Erases all prior .odd files.
 # Scan for Oddmuse SVG files, and generate .odd stubs for them.
 # If "Source" is found at the end of an SVG filename, it is removed.
 ODD_DIR="$1"  # directory including notes.txt; default: "."
 if [[ "$ODD_DIR" == "" ]]; then
 if [[ ! -f "$NOTES" ]]; then
     echo "error: $NOTES not found" > /dev/stderr
     exit 1
 rm -f "${ODD_DIR}/*.odd"
 URLBASE=`cat "$NOTES" | grep -e "^urlbase" | cut -d" " -f2`
 wget "${URLBASE}?search=%5E%23FILE+image%2Fsvg;raw=1;context=0" -o "$ODD_DIR"/scan.log -nv -O- |
 while read FILENAME; do
     touch "${FILENAME%Source}.odd"

Run this script in the directory. Make sure you have a notes.txt file; if you don’t have one, you’ll get a nasty message about that.

It will pull down “.odd” files from the wiki.

For example, if there’s an SVG image called FooBarSource on the wiki, you’ll end up with a file FooBar.odd in your directory.



This file tells Inkscape that users can “Save as” an “Oddmuse Wiki POST”. When the user selects it, Inkscape will call svg2oddmuse.sh.

Where is svg2oddmuse.sh? In the extensions directory, right next to this file. It must be executable.


This script has to do a bunch of trickery.

Why? Because we’re really doing more than Inkscape was prepared to handle.

For example, we want the name of the page the user is saving to. If the user saves to file “InkscapeToOddmuse.odd” in directory “/home/lion/my/img/cw", we have to figure out that ''really'' means they want to save an SVG and a PNG to page "InkscapeToOddmuse" on wiki "http://www.emacswiki.orgcw” as user “LionKimbro”, or whatever.

Inkscape doesn’t even give us the name of the file, or the directory we’re saving into. So we have to deduce all that information from the SVG file we’re given a pointer to.

Hence, the trickery.


svgattrs.py prints all the attributes attached to the “<svg …>” element.

We do this so that the bash script can pick out the ones it wants.

In particular:

Put this script in with the others, in the extension directory. Make it executable.


We need a script to upload to the wiki, and it’s called “oddmuse-upload.py.” Basically it’s just a copy of Oddmuse:wikiupload. It must be executable.


Note, if many of the other files in the extension directory end in .inkmod then use odd_input.inkmod instead of odd_input.inx.

It tells Inkscape where to find the .odd stubs, and what script to use to download what they point to.


This is the script that does the actual heavy listing. Make it executable.

See Also


All done!

Late though, I don’t have time to make a diagram now. :(

But in the not to distant future, … ;)

Ph33r the VisualLanguage!

This is totally cool!

Wow! This is really fantastic Lion!

I’m working on FC4 with Inkscape 0.43 and I had to get rid of the --export-area “0:0:$WIDTH:$HEIGHT from svg2oddmuse.sh because of a strange interaction between pt and px. The image was specified in pts but the rasterization was turning the pts into px so that part of my document was getting shorn off.

Thanks. :)

Actually, I’m using a different Python module and stuff now, that’s a bit more elegant; BUT, I can’t get the “save from within Inkscape” to work on Windows. :P I’ll post it some other time.

I’m giving it another try. At the moment TestImage looks good except that the top and right edges are cut off. Any idea what this could be? Something about screen dpi and pt perhaps…

I can’t seem to find my Inkscape extensions directory on my MacBook?. Any other ideas where I might look? I’ve used the Mac’s search function and looked through all the “extensions” directories I found, but none of them is for Inkscape. Thanks!

Well, it says /Applications/Inkscape.app/Contents/Resources/extensions/ at the top of this page. But if that doesn’t work, I don’t know. Find your Inkscape application, use a control-click, choose open this package, and try to find the Contents/Resources/extensions directory, I guess.

Thanks. I’m new to Mac and didn’t know how to do open the package. I wonder why the contents of the package don’t show up with a search. Oh well.

I was able to open an image from ConsensusPolling and edit the file. When I went to save I found the 415 UNSUPPORTED MEDIA TYPE error as described above. I can’t find a mime.types file in the directory listed above or in any of the 4 other directories suggested by Inkscape. Any help on where to find it? Or is this a setting of the wiki and not my machine? Brandon uses the OddmuseToInkscape extension with his work on this image so I’m pretty sure the wiki is set up correctly. I’ll also ping him for help.

I guess you could change the first call to oddmuse-upload.py in svg2oddmuse.sh by adding a -t 'image/svg+xml'.

"$EXEC_DIR/oddmuse-upload.py" -t 'image/svg+xml' -u "$USERNAME" -s "$SUMMARY" "$SRC" "$TARGET" 1>&2


That would get rid of the requirement to modify the MIME types known on your system.

If that still doesn’t help, check the wiki config (assuming you have access to it) and add the following:

push(@UploadTypes, 'image/svg+xml');

It seems I didn’t actually check the wiki to see if the image was uploaded before I posted my report about the error. In spite of the error, the image was uploaded as updated. Hmm. Thanks, Alex!

Define external redirect: MacBook

EditNearLinks: ConsensusPolling