If you blog it they will come?

Tuesday, December 23, 2008

Python Imaging Library

I've been diving into Python and trying to craft short little programs to improve my skillz.

One of the first Python extensions I made a move for was the Python Imaging Library. The PIL packs in an impressive amount of file format compatibility; loading and creating images could hardly be simpler.

For 90% of your typical use cases I'd say PIL does great, since loading saving and doing simple transformations on images is ridiculously simple. The PIL even supports drawing directly on images with polygons and other primitives. This is where my list of annoyances begins.

When you're drawing on an image, it seems only natural to desire transparency of shapes. Strangely, this is not possible. After some digging it seems the closest hack is to draw on a buffer image and then blend() or paste() with the original to achieve transparency. This is alright as long as the number of shapes are limited.

However, if you're trying to create multi-layered vector art, PIL isn't really up to the task.

In order to achieve the incremental layering of these shapes with true alpha values, I had to write my own pixel-by-pixel merge function, which was ridiculously slow. I'm sure there might have been a better way to do it but I found some of the documentation lacking, and on further investigation it's just literal comments from the source code, with few usage examples.







The above images took about a minute each to render, so there goes my plan to create a fun hill-climbing afternoon evolutionary image grinder. I might give this another stab with some Python OpenGL libraries.

Wednesday, December 3, 2008

Graphics class final project.

Well, I'm slowly but surely taking my tuition money back out of the department by snatching their various prize giveaways. Yesterday I received an Amazon gift certificate in my inbox from "The CSE Department" for qualifying in the regional ACM programming contest.

Today I took away a WALL-E 3-DISC Special Edition, an excellent and relevant reward for coming in second place in our graphics class' animation short festival. My graphics partner Robert and I built a strange little one-eyed Residents-style toaster creature which likes dancing and creating toast. Here's the full clip:




I'm also adding the original dancing clip below because unfortunately we didn't match up our video resolutions and it clipped out a lot of the detail. Here it is:


Dancing eye ball toaster from a f on Vimeo.

Tuesday, December 2, 2008

Last summer's big ol' DNS scare

An entertaining and well-written article about a crucial internet security flaw last summer:

Dan Kaminsky destroys, saves internet etc.

A scary reminder of how the entire web hinges on the security of e-mail of all things.

Monday, December 1, 2008

Opencongress.org

I just discovered Open Congress, a pretty sweet site for bringing clarity and perspective to US politics + legislation.

For example, check out the page for HR 2082, the CIA funding bill vetoed by Bush for its interrogation tactics restrictions:

H.R. 2082

You can see who voted Aye, Nay or abstain, its amendments, its trajectory through Congress (ending in a failed override) and related bills and news articles.

For example, these 4 Senators voted "Nay" on the bill:

Waterboarding fans

Unfortunately I could not locate a convenient "Contact this politician" button so that I could quickly dispatch an appropriate nastygram. At the least, it could link me to their Facebook profile (seeing as how I can "share" Senator Chambliss with all my friends on Facebook...)