private static int scaleDimension()

in thumbnails4j-core/src/main/java/co/elastic/thumbnails4j/core/ThumbnailUtils.java [206:214]


    private static int scaleDimension(int value, int targetValue){
        if (value > targetValue) {
            return Math.max(value / 2, targetValue);
        } else if (value < targetValue) {
            return Math.min(value * 2, targetValue);
        } else {
            return value;
        }
    }