I want to make a image with rounded corners. A image will come from input and I will make it rounded corner then save it. I use pure java. How can I do that? I need a function like
public void makeRoundedCorner(Image image, File outputFile){
.....
}

Edit : Added an image for information.
I suggest this method that takes an image and produces an image and keeps the image IO outside:
Edit: I finally managed to make Java2D soft-clip the graphics with the help of Java 2D Trickery: Soft Clipping by Chris Campbell. Sadly, this isn’t something Java2D supports out of the box with some
RenderhingHint.Here’s a test driver:
This it what the input/output of the above method looks like:
Input:
Ugly, jagged output with
setClip():Nice, smooth output with composite trick:
Close up of the corners on gray background (
setClip()obviously left, composite right):