JPEG、GIF、および PNG ファイルの画像 URL があります。これらの URL の画像が特定のサイズよりも小さいかどうかを確認したい。
それに基づいて、画像をダウンロードしたいと思います。
そのためのJavaのImageIOライブラリがありますが、それはAWTライブラリにあり、Android用のものが必要です。
URLConnection メソッド getContentLength() を使用して、画像サイズを簡単に取得できます。
URL url = new URL("https://www.google.com.pk/images/srpr/logo4w.png");
URLConnection conn = url.openConnection();
// now you get the content length
int contentLength = conn.getContentLength();
// you can check size here using contentLength
InputStream in = conn.getInputStream();
BufferedImage image = ImageIO.read(in);
// you can get size dimesion
int width = image.getWidth();
int height = image.getHeight();