@Nullable
    public static ImmutablePair<Integer, Integer> getImageSize(@Nullable final Uri imageData) {
        if (imageData == null) {
            return null;
        }
        try (InputStream imageStream = openImageStreamIfLocal(imageData)) {
            if (imageStream == null) {
                return null;
            }
            final BitmapFactory.Options bounds = new BitmapFactory.Options();
            bounds.inJustDecodeBounds = true;
            BitmapFactory.decodeStream(imageStream, null, bounds);
            if (bounds.outWidth == -1 || bounds.outHeight < 0) {
                return null;
            }
            return new ImmutablePair<>(bounds.outWidth, bounds.outHeight);
        } catch (IOException e) {
            Log.e("ImageUtils.getImageSize", e);
        }
        return null;
    }
Store a bitmap to uri.

@param bitmap    The bitmap to store
@param format    The image format
@param quality   The image quality
@param targetUri Path to store to
main/src/main/java/cgeo/geocaching/utils/ImageUtils.java