The problem statement is to rotate an image clockwise 90 degrees for which here we will be using some in-built methods of BufferedImage class and Color c
Classes required to perform the operation is as follows:
- To read and write an image file we have to import the File class. This class represents file and directory path names in general.
- To handle errors we use the IOException class.
- To hold the image we create the BufferedImage object for that we use BufferedImage class. This object is used to store an image in RAM.
- To perform the image read-write operation we will import the ImageIO class. This class has static methods to read and write an image.
- This Graphics2D class extends the Graphics class to provide more sophisticated control over geometry, coordinate transformations, color management, and text layout. This is the fundamental class for rendering 2-dimensional shapes, text, and images on the Java(tm) platform.
Output: After executing the program console will show dimensions and executed message and a new rotated image will be created at the path entered as shown:
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.