Category: Java

java tutorials

Compress Images Java Example

This tutorial shows how to compress images in Java. You can reduce an image file size by compressing an image. This file reduction sometimes leads to increased performance and decreased network bandwidth. But when...
java tutorials

Convert BufferedImage to Byte Array in Java

In this example we demonstrate how to convert a BufferedImage to byte[] using standard Java. We use try-with-resources to manage the closing of OutputStream. Convert BufferedImage to Byte Array We create the BufferedImage by...
java tutorials

Convert Image to Grayscale using Java

In this example we demonstrate how to convert Image to Grayscale using Java. Convert Image to Grayscale We use the ImageIO.read() method to read an image to BufferedImage. Then we loop over each pixel...
java tutorials

Convert Image to Black and White using Java

This example demonstrates how to convert an image to Black and White using Java. A 1-bit image is created with an IndexColorModel with two colors in the default sRGB ColorSpace: {0,0,0} and {255,255,255}. Convert...