JAI (Java Advanced Imaging API) will do the job, but has some disadvantages.
The API is far from easy to use, especially if you care about the memory area ...
IMHO Java is not the best platform for image processing tasks. You can try ImageMagick , a great command line tool used by popular sites like Flickr. You can integrate ImageMagick into your Java application using the command line (Runtime.exec ()) or Jmagick , which is the Java bridge for ImageMagick
source share