NerdVana

There are 10 types of people: those who speak binary, and those who don't.

Dirpy: dynamic image modification

Written by Eric Schwimmer

I wrote a big thing: a standalone Python/uwsgi daemon named Dirpy, which can dynamically modify/resize local or remote images based on a complex (yet easily understood) command hierarchy encoded in the query string.

We use it quite a bit at Redfin, and it's reaped us some big savings. It cut the disk utilization on our image servers in half (almost exactly), as we no longer needed to store pre-rendered derivative imaged for all of the various viewport sizes that we support (iPhone, iPad, desktop, etc). It also reduced the amount of developer time required to generate these derivative images from hours (spent mucking about in Java code) to mere seconds (adding 2 lines to an Nginx config). And... it provided noticeably higher quality images than the previous Java-based resizing code (as Dirpy leverages Pillow/PIL, which supports tri-lobed Lanczos resampling filters). So, Win Win Win.

It also scales pretty well. A single 40 core image server is capable of re-sizing over 1000 images/second, using Dirpy (assuming a 1024x768 base image size). Not too shabby!

Check it out on the Redfin github page: https://github.com/redfin/dirpy DERP!