I am using Jsoup to get images of a web page.
Following is my code:
private String getImage(Document doc) {
Elements images = doc.select("img[src~=(?i)\\.(png|jpe?g|gif)]");
String imgUrl = "";
for (Element image : images) {
imgUrl = image.attr("abs:src");
break;
}
return imgUrl;
}
Here I am getting first image of page, But I need image having max height or max width in page.
I can not use attr("height") as most of images does not have height and width attribute.
Can anyone help me how can I calculate height and width of images not having attribute height and width?
Thanks