private void setSampleSize(final Uri uri, final BitmapFactory.Options bfOptions) {
        //Decode image size only
        final BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;

        InputStream stream = null;
        try {
            stream = ContentStorage.get().openForRead(uri);
            if (stream == null) {
                Log.i("Cannot open file from " + uri + ", maybe it doesnt exist");
                return;
            }
            BitmapFactory.decodeStream(stream, null, options);
        } catch (final Exception e) {
            Log.e("HtmlImage.setSampleSize", e);
        } finally {
            IOUtils.closeQuietly(stream);
        }

        int scale = 1;
        if (options.outHeight > maxHeight || options.outWidth > maxWidth) {
            scale = Math.max(options.outHeight / maxHeight, options.outWidth / maxWidth);
        }
        bfOptions.inSampleSize = scale;
    }
Load a previously saved image.

@param file      the file on disk
@param forceKeep keep the image if it is there, without checking its freshness
@return a triplet with image in the first component, Metadata in second (only if loadMetadata=true) and
{@code true} in the third component if the image was there and is fresh enough or {@code false} otherwise,
and the image (possibly {@code null} if the third component is {@code false} and the image
could not be loaded, or if the third component is {@code true} and {@code onlySave} is also
{@code true})
main/src/main/java/cgeo/geocaching/network/HtmlImage.java