Category: IO
Java Image Transparency Detection BufferedImage
In this tutorial we demonstrate how to detect image transparency in java. The first method is to check if an image contains an alpha channel. In the second method we loop over each pixel...
Adding Text or Image as Watermark to an Image in Java
The following tutorial demonstrates how to add a watermark to an image in java. We show you two examples. The first example adds a text watermark to an image. The second adds an image...
Java Resize Image to Fixed Width and Height Example
In this tutorial we show a Java Resize Image to Fixed Width and Height Example. We can resize an image using different algorithms. Each algorithm focuses on a different aspect. You can configure the...
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...
How to Convert Byte Array to String in Java
This tutorial demonstrates how to convert a byte[] to String. Encoding this String into a sequence of bytes using the given Charset, storing the result into a new byte array. byte[] byteArray = “this...
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...
Compress and Decompress Java JAR File with Apache Compress
In this tutorial we demonstrate how to compress and decompress Java JAR files using Apache Compress. In general, JAR archives are ZIP files, so the JAR package supports all options provided by the ZIP...
Java TAR example – compress and decompress *.tar or *.tar.gz files
This tutorial demonstrate how to compress files or directories recursively in .tar or .tar.gz format and how to decompress a .tar or .tar.gz file. Project Structure Let’s start by looking at the project structure....
Java 7z Seven Zip Example – compress and decompress a file
In this tutorial we demonstrate how to compress files to 7z format recursively and decompress 7z files. 7-Zip also known as 7z is a compressed archive file format that supports several different data compression,...