Here you can find the source of getImageWH(String path)
public static int[] getImageWH(String path)
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import android.graphics.BitmapFactory; public class Main { public static int[] getImageWH(String path) { int[] wh = { -1, -1 }; if (path == null) { return wh; }/*from w ww.j a v a2 s. c o m*/ File file = new File(path); if (file.exists() && !file.isDirectory()) { try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; InputStream is = new FileInputStream(path); BitmapFactory.decodeStream(is, null, options); wh[0] = options.outWidth; wh[1] = options.outHeight; } catch (Exception e) { } } return wh; } }