Skip to content
Advertisement

Tag: bufferedimage

How to create 8-bit PNG from BufferedImage?

I have a Java program that creates composite png images that contain only black pixels and 100% transparent pixels. I am trying to reduce the size of these composites as much as possible and I notice that ImageIO.write always outputs 32 bit PNG’s. I would like to instead save them as 8-bit considering that the images will only have two

Java: Filling a BufferedImage with transparent pixels

I have an off-screen BufferedImage, constructed with the type BufferedImage.TYPE_INT_ARGB. It can contain anything, and I’m looking for a way to (fairly efficiently) completely overwrite the image with transparent pixels, resulting in an ‘invisible’ image. Using something like this: Has no effect. One possible method might be just to write over every pixel in the BufferedImage, but I’m not sure

How to scale a BufferedImage

Following the javadocs, I have tried to scale a BufferedImage without success here is my code: I can’t understand why it is not working, any help? Answer AffineTransformOp offers the additional flexibility of choosing the interpolation type. The fragment shown illustrates resampling, not cropping; this related answer addresses the issue; some related examples are examined here.

Advertisement