A simple content-aware image resizer, quite small, readable and fast: over 6 times faster than the LiquidRescale GIMP plugin, which is written in C.
Seam carving is a recently presented method to resize images "intelligently",
by removing pixels of the image that carry little information. It can do
things like turning this image into
this one
Go watch the video for more examples.
I quickly reimplemented it in OCaml, obtaining an unexpected
two-order-of-magnitude speed increase. This was slightly surprising because the Python version uses optimized extensions written in C, and Psyco should have brought the parts written in Python to at least one tenth of the native speed. In this case, the key, it turns out, was not the implementation language but the algorithm itself.