Create an image with rounded corners
public static void main(String args) throws Exception
// Get the BufferedImage object for the image file
BufferedImage originalImg=ImageIO.read(new File(args));
// Get the width,height of the image
// Create a new BufferedImage object with the width,height
// equal to that of the image file
BufferedImage bim=new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
// Create a Graphics2D object by using
// createGraphics() method. This object is
// used to perform the operation!
// You can also use rendering hints
// to smooth the edges or the rounded rectangle
RenderingHints qualityHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
// This method does it all!. You can clip the
// image into the shape you wish, play it as you like!
// Now, draw the image. The image is now
// in the 'clipped' shape, the shape in the setClip()
// Dispose it, we no longer need it.
// Write to a new image file
Sample rounded image, an output of the program
If you love this post, you'll love other posts too, share it `only` if you like it. Also, don't forget to drop your eyes on other posts draw and save an image in java and pasting an image from clipboard