I needed something like this for one of the projects I'm doing and I found this program to help me out. Unfortunately it looks as if it only works with Windows at the moment.
I'm still trying to find a web based one with an API. Maybe if I have the time I can try to create one. Not sure how I would approach it since I've never really done image manipulation.