I used and liked using the GIMP with Perl about a year or so ago. GIMP has a perl server and lets you do lots of photoshop-type things from perl. I used a simple interactive command line shell (using readline, I think I based it on something called pgshell) to test things and then after editting the command history put the commands into perl subroutines.
This, plus programming navigation rules and creating templates, enabled me (after a week or two) to build a thousand page site with a thousand photos, highlighting thumbnails laid out in a circular fashion, and lots of subsection links, in approximately 10 minutes of 100% CPU. Maybe two thirds of that time was spent watching The GIMP go crazy opening and closing windows, resizing them, etc.; the remaining time was used to generate the pages themselves (since we had were not able to use perl online actually).
Some interesting bits were being able to resize an image along its long axis and composite a frame using alpha channel masking. The best thing of all of course was when I got told that a bunch of photos would change. This would have been impossible to do in the time available considering everything that would have to be changed, with my "Magic Hands" Gimp compositing system it was easy. Anyway you may be interested to see what is possible even if it turns out too heavy for your project.
I did find some difficulty actually reading photoshop files sometimes, but this was many versions ago. There is a Film-Gimp project where it is used for filmmaking, you may find that useful too. I think there may be a way to run it from the command line, but don't know if you can get the perl server to launch.