Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.BitmapFactory; import android.graphics.Point; import android.text.TextUtils; import java.io.IOException; import java.net.URL; public class Main { /** * get image size by path */ public static Point getImageSize(String path) throws IOException { if (TextUtils.isEmpty(path)) { return null; } BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; if (path.startsWith("http")) { BitmapFactory.decodeStream(new URL(path).openStream(), null, options); } else { BitmapFactory.decodeFile(path, options); } return new Point(options.outWidth, options.outHeight); } }