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