Yesterday I was working on something that requires manipulation of image for getting its properties.
After searching over the internet I found a very intersting class on Java i.e ImageIO and BufferedImage class.
These classes are good enough to manipulate images. there are many other claases also. But what I need i got it from these. I found many developers searching over internet for getting properties of image and there is no good small example for that.
Thats why I thought why not creating a simple code to manipulate the image and help the developers.
Here is the small code that helps to get the height and width of the image. Enjoy it!!
After searching over the internet I found a very intersting class on Java i.e ImageIO and BufferedImage class.
These classes are good enough to manipulate images. there are many other claases also. But what I need i got it from these. I found many developers searching over internet for getting properties of image and there is no good small example for that.
Thats why I thought why not creating a simple code to manipulate the image and help the developers.
Here is the small code that helps to get the height and width of the image. Enjoy it!!
import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class GetImage { public static void main(String[] args) { try { File f = new File("E:/Vinod/Docs/Pics/krishna_01.jpg"); BufferedImage image = ImageIO.read(f); int height = image.getHeight(); int width = image.getWidth(); System.out.println("Height : " + height); System.out.println("Width : " + width); } catch (IOException ioe) { ioe.printStackTrace(); } } }
Hi tank yout
ReplyDeleteFrom Bolivia
Chauu
thanks for the nice post and its really works
ReplyDeletenice n simple..:)
ReplyDeleteBut i was trying d same without using imageIO n BufferedImage.. but no success yet.. can u hekp me on this?
Thank you this helped me so much!
ReplyDeleteThank you very much!!!
ReplyDeleteI needed it!!!
This help me to solve my problem with 3 code rows...
Good Works!!
Very useful code, Thank you!
ReplyDeleteThanks a lot bro .. :)
ReplyDeleteBro Thanksssssssssssssssssssssssss a lot ...
ReplyDeleteu saved my life ...
love you
:)
:)
ReplyDeleteWhat units are the width and height in? percentage, pixels, millimeters ?
ReplyDeletecan anyone know how to obtain camera model and maker in java
ReplyDeletecan anyone know how to obtain camera details like date taken,model.....in java
ReplyDeleteThank you bro
ReplyDelete