Image Compression using Java AWT compresses image size using inbuilt Java classes like BufferedImage and ImageIO.
In this project Image compression using Java AWT, we compress the image size using different classes provided by Java itself. In this project, we use inbuilt classes like BufferedImage and ImageIO classes to reduce or compress the size of the image.
Compressing the size of the image which in turn reduces the quality of the image. the input format of the image is ".jpg" and the output image which we obtain after compression is also an image of format ".jpg". we specify the path of the image i.e. where the image is located while taking the input. the input image is saved in the form of a file.
we also specify the output path to which our compressed will be saved. In the code, we will specify the compression factor so that the input image will be compressed by that factor and gives us the output. Here are the properties of the input image where the image path and the image size are shown.
after executing the above input image through image compression using Java we get the reduced output size of the image located at that particular location.
the code will be pasted below in the zip format.
the input image uploaded before compression is as shown below.
the compressed image for the above image with the compression factor 0.03 is shown below.
we can compress the image with any factor like 0.03,0.3,0.5 etc. and get the corresponding output image.
Submitted by Deepak Anumala (deepak12anumala)
Download packets of source code on Coders Packet
Comments