code: public static Point getSize(ContentResolver resolver, Uri uri) {
          InputStream is = null;
          try {
              BitmapFactory.Options options = new BitmapFactory.Options();
              options.inJustDecodeBounds = true;
              is = resolver.openInputStream(uri);
              BitmapFactory.decodeStream(is, null, options);
              int width = options.outWidth;
              int height = options.outHeight;
              return new Point(width, height);
          } catch (FileNotFoundException e) {
              Log.e(TAG, "target file (" + uri + ") does not exist.", e);
              return null;
          } finally {
              CloseableUtils.close(is);
          }
      }
docs: Get width and height of the bitmap specified with the {@link android.net.Uri}.
  @param resolver the resolver.
  @param uri the uri that points to the bitmap.
  @return the size.