Is there an easy way to manipulate PNGs in Java? I know I can read into a BufferedImage and write that back out, but I need to add clear pixels around the edge of an image. Is there an easy way to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Never tried it but you could try creating a buffered image at the appropriate size including the border you want around the image. So for a border of 5 pixels the code might be something like:
Or if you want to keep the image at its original size then you just use 4 fillRect(…) methods to overwrited the top/bottom/left/right edges of the image.