Image compression using java

There are no specific API is available for compressing the images.

Supported format files are JPG (Joint Photography Experts Group) and PNG (Portable Network Graphics)
  • Download Jar (Java Archive) which is developed by Java Query API
  • Create a instance using ImageResize Class and using that object call the method compressImage

ImageResize ir = new ImageResize();
 ir.compressImage("Source Location", "Destination ", width, height);

String Parameter: Source Location and Destination
Integer Parameter: width and height

Parameters Description:

·         1st Parameter : Source Location , Example c:\\demo\\image.jpg
·         2nd Parameter : if you mention “default” then it will compress the original image and if you mention the destination location then it will create a new compressed image
·         3rd Parameter  & 4th Parameter : if you enter 0 for both then image resolution will not change but if you mention some value greater than 0 then image resolution will be changed.

That’s it.  Thanks to the Java Query API for implementing this API.

Popular posts from this blog

Database Multi Language Support Format

Five More Indian Languages - Google Translate