Java tutorial
//package com.java2s; import java.io.InputStream; import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import android.util.Pair; public class Main { public static Pair<Integer, Integer> getDimensionsForStream(InputStream in) { Options options = new Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(in, null, options); return new Pair<Integer, Integer>(options.outWidth, options.outHeight); } }