katu, for what its worth, imgscalr will do all of this for you significantly easier than using JAI (single, static, method calls to perform all these ops). You can check the class Javadoc here.
You can add this Maven entry and get started with the lib immediately (no config or complex API, just call Scalr.* methods)
<dependency>
<groupId>org.imgscalr</groupId>
<artifactId>imgscalr-lib</artifactId>
<version>4.2</version>
</dependency>