If this is on a Linux server, one way to do it is to find
all items under media/catalog/product/cache
last accessed older than xxx
days and delete. Run it periodically to clean out old cached images. Magento will recreate anything that still exists in the product images store.
Something like the following ($DOCDIR is path to your http doc root):
find $DOCDIR/media/catalog/product/cache/* -type f -atime +365 -exec rm -f {} \;
While this isn't Magento programmatic (since Magento doesn't do certain important housecleaning EVER and therefore doesn't have any built-in mechanism) it could be worked into some sort of adjunct module to compliment the next item below which you will need to do some of the above disk eating missing housecleaning.
Also, there's a free module Image Clean that will delete the unused original images that are left behind when you delete product from your catalog.