Java tutorial
//package com.java2s; import java.io.InputStream; import android.graphics.BitmapFactory; public class Main { public static boolean decodeImageBounds(final InputStream stream, int[] outSize) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(stream, null, options); if (options.outHeight > 0 && options.outWidth > 0) { outSize[0] = options.outWidth; outSize[1] = options.outHeight; return true; } return false; } }