Wednesday, August 22, 2012

Java - Image resizing

In this article we will see how to resize a given image to our desire size using Java program. It may be required to resize a large image to 100x100 icon or any other size. It also helps to compress the memory of an image. Image resizing can be required for may reasons - Lets say we want to loan an image in mobile browser, it is not adviceable to load the large image as it is because it may hit page loading time and ofcourse it will create bad experience to end user.

About the example : This is a simple Java program which will resize an image to any other desire size. we have a function resizer() which accepts 4 parameter - Original file, width, height and desire extension. Directly you can run the program and see the out put no need to add any JAR files.

Please see the self explantory program below.

Output :

Original image