Auto Cropping

I’ve just started a project that involves using Blender to make sprites for a flash game. Right now i have about fifty or so objects that are going to need to be rendered from eight angles each, and Blender is already set up to render them in bulk. The only problem is that not all the objects are the same size, and they need to be cropped down as small as possible.

I could adjust the output resolution or cropping manually, but there’s a good chance to screw up with 400+ renders. Is there anyway at all to use nodes to automatically crop a set of images down so that only parts where the alpha value is 0 are removed? Here’s a crude example:

before    after
000100    0010
011110    1111
011110    1011

try searching around for a script to scale all the objects to fit within the same bounds?

Well that is an idea, but i don’t know how well it would work.The difference between the smallest and largest objects is more than a little noticeable. And I’d like to try to keep the final renders at about the same scale for simplicity.

For the time being Ive been just using the autocropping in GIMP. I suppose if there’s no blender solution, I might just settle for setting up a macro to speed things up.