hi I am using Jtidy parser in java.
URL url = new URL("http://l1.yimg.com/t/frontpage/baba-ramdev-310511-60.jpg");
Image image = new ImageIcon(url).getImage();
int imgWidth = image.getWidth(null);
int imgHeight = image.getHeight(null);
Above code is working fine,I am getting height & width properly.But I want to see the size of an image (for example whether it is in KB,or in MB ).Please help me,how to get the size of an image.Is there any method.
Use a HEAD request to get the content length
How to count your bytes & eat them too.
Try:
If this doesn't work, you can load the stream using:
...and read the stream until the end, counting how many bytes were actually read. You might also use
CountingInputStream
decorator to reuse the stream later. However the first code snippet seems to work.This is one of the simplest method to find the dimensions of image.