I think you can script operations in GIMP, and if memory serves, I once scripted simple operations in an old (pre-CS) version of Photoshop. The latter was on a Mac, so it I might have done the scripting through the OS instead.