If you don't find a solution to your problem, give Image Magick a try http://www.imagemagick.org/