python

Sun's Da Vinci Machine Gains Traction

Sun's MLVM aka "The Da Vinci Machine" caters for the needs of many compiled and interpreted languages. Since Sun already gathered a lot of expertise with the JVM it's going to be a sure hit. Reliability and performance will be equally excellent without a doubt. And of course it will also run Java.

Yesterday during his keynote at Sun Tech Days James Gosling announced that they hired Ted Leung (a long-time Python developer from OSAF) and Frank Wierzbicki (the lead implementer of the Jython project). Both are going to work full-time on Jython - an implementation of Python written in 100% pure Java.

How to Use Inkscape's Command Line Options on Win32

On Windows you won't have much fun with Inkscape's command line options. They do work just fine, but you won't see any feedback messages. While the messages are written to stdout and stderr, these streams aren't connected to anything. And all that eventually useful information is flushed down the virtual toilet.

(If you aren't interested in the details skip over to InkCL.bat usage and the zip package.)

That's just how things are with Windows - either spawn a cmd.exe window or get nothing. Getting some extra cmd window each time you use Inkscape would be a tad annoying, therefore the other option was chosen. Java solves it with two executables: java.exe and javaw.exe (where the former spawns a cmd window and the latter doesn't).

In Java's case they are tiny wrappers. Inkscape is a lot bigger tho, therefore that wouldn't be the smartest thing to do. ~6.7mb just for better command line support? Naaah. However, a tiny separate wrapper program, which just spawns Inkscape.exe as child process would work fine. Ultimately it's the best option and most likely the one we'll pick.

As a temporary solution for the time being you can use the following Python program. It hands the command line arguments over to Inkscape and grabs the stdout and stderr streams and prints 'em on screen.

Planet Woes

Planet is some RSS aggregator written in Python we're using over at Planet Inkscape. But maybe I should start at the beginning.

Lots of weird requests which resulted in 404s showed up in the log. Things like:

XX at http:/kaioa.com
XX at
XX
XXathttp:/kaioa.com

Where "XX" stands for the node id. E.g. "36" for this blog post.

After investigating it for a bit I found the shocking reason behind this.

Effects->Color->Custom... Now Without Bugs!

I almost forgot to fix this. There was some silly bug, which caused the evaluated new color values to overwrite the old ones. E.g. if your red function changed the red channel and if you use the red channel in the green or blue function, the calculation was way off.

Well, this is fixed now. Finally you can do stuff like custom grayscale functions. For example if you don't like the NTSC/PAL scheme, which is used by Effects->Color->Grayscale, you can now use a different one. For the ITU-R Recommendation BT.709 conversion you would use the following line for all three channels:

0.2125 * r + 0.7154 * g + 0.0721 * b

For comparison the NTSC/PAL one looks like this:

0.299 * r + 0.587 * g + 0.114 * b

Feel free to try your own weights. You can also try slightly heavier weights in the red channel and a tad heavier weights in the green channel for sepia-ish pseudo grayscale. Or something completely different. Since the calculated values are clamped (0 to 255), there won't be any problems.

Inkscape Randomize Color Effect

Back when I wrote the first set of color effects I thought this specific effect would be useless. However, I was wrong as I found out recently. Sometimes you really need a quick way to tint zillions of shapes in one go.

A specific example would be breaking apart some potraced (path->trace bitmap) path. Colorizing it in some random fashion is good enough for checking if everything went well.

a map of Bosnia and Herzegovina
A map of Bosnia and Herzegovina with random lightness.

And now you can easily see that the geometry is reasonable and that each region can be tinted individually. :)

Syndicate content