javaimgscalr

Determine the size of an image using ImgScalr


Hi I am currently using ImgScalr library and I have few markers to download images from an HTML document , however sometimes the images are of low quality,and if they are then I need to scan thru the html source to download all the images and use the one with the biggest size in bytes.

I use ImgScalr library, I need to know how I can check the size of the image in bytes to determine if it meets my quality requirements. Is it the right approach?

Thanks.


Solution

  • imgscalr author here - the library is focused on image operations only, operating on the uncompressed BufferedImage objects.

    To know the actual file size you would just download all the images from the HTML page to a directory and then iterate through the files using the standard Java File operations to determine the file size.

    If you are using Java 7+ you can use the handy Files.size operation.