public static int getScale(Point size, int width, int height) {
        if (size.x > width || size.y > height) {
            return Math.max(Math.round((float) size.y / (float) height),
                    Math.round((float) size.x / (float) width));
        } else {
            return 1;
        }
    }
Get scale for image of size and max height/width

@param size
@param width
@param height
@return scale
app/src/main/java/com/github/pockethub/android/util/ImageUtils.java