Java Code Examples for com.nostra13.universalimageloader.utils.ImageSizeUtils#computeImageSampleSize()

The following examples show how to use com.nostra13.universalimageloader.utils.ImageSizeUtils#computeImageSampleSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseImageDecoder.java    From candybar with Apache License 2.0 6 votes vote down vote up
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
    ImageScaleType scaleType = decodingInfo.getImageScaleType();
    int scale;
    if (scaleType == ImageScaleType.NONE) {
        scale = 1;
    } else if (scaleType == ImageScaleType.NONE_SAFE) {
        scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
    } else {
        ImageSize targetSize = decodingInfo.getTargetSize();
        boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
        scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
    }
    if (scale > 1 && loggingEnabled) {
        L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
    }

    Options decodingOptions = decodingInfo.getDecodingOptions();
    decodingOptions.inSampleSize = scale;
    return decodingOptions;
}
 
Example 2
Source File: BaseImageDecoder.java    From letv with Apache License 2.0 6 votes vote down vote up
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
    int scale;
    ImageScaleType scaleType = decodingInfo.getImageScaleType();
    if (scaleType == ImageScaleType.NONE) {
        scale = 1;
    } else if (scaleType == ImageScaleType.NONE_SAFE) {
        scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
    } else {
        boolean powerOf2;
        ImageSize targetSize = decodingInfo.getTargetSize();
        if (scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2) {
            powerOf2 = true;
        } else {
            powerOf2 = false;
        }
        scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
    }
    if (scale > 1 && this.loggingEnabled) {
        L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), Integer.valueOf(scale), decodingInfo.getImageKey());
    }
    Options decodingOptions = decodingInfo.getDecodingOptions();
    decodingOptions.inSampleSize = scale;
    return decodingOptions;
}
 
Example 3
Source File: DiskDecoder.java    From talk-android with MIT License 6 votes vote down vote up
protected BitmapFactory.Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
    ImageScaleType scaleType = decodingInfo.getImageScaleType();
    int scale;
    if (scaleType == ImageScaleType.NONE) {
        scale = 1;
    } else if (scaleType == ImageScaleType.NONE_SAFE) {
        scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
    } else {
        ImageSize targetSize = decodingInfo.getTargetSize();
        boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
        scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
    }
    if (scale > 1 && loggingEnabled) {
        L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
    }

    BitmapFactory.Options decodingOptions = decodingInfo.getDecodingOptions();
    decodingOptions.inSampleSize = scale;
    return decodingOptions;
}
 
Example 4
Source File: BaseImageDecoder.java    From mobile-manager-tool with MIT License 6 votes vote down vote up
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
	ImageScaleType scaleType = decodingInfo.getImageScaleType();
	int scale;
	if (scaleType == ImageScaleType.NONE) {
		scale = 1;
	} else if (scaleType == ImageScaleType.NONE_SAFE) {
		scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
	} else {
		ImageSize targetSize = decodingInfo.getTargetSize();
		boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
		scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
	}
	if (scale > 1 && loggingEnabled) {
		L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
	}

	Options decodingOptions = decodingInfo.getDecodingOptions();
	decodingOptions.inSampleSize = scale;
	return decodingOptions;
}
 
Example 5
Source File: BaseImageDecoder.java    From BigApp_WordPress_Android with Apache License 2.0 6 votes vote down vote up
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
    ImageScaleType scaleType = decodingInfo.getImageScaleType();
    int scale;
    if (scaleType == ImageScaleType.NONE) {
        scale = 1;
    } else if (scaleType == ImageScaleType.NONE_SAFE) {
        scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
    } else {
        ImageSize targetSize = decodingInfo.getTargetSize();
        boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
        scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
    }
    if (scale > 1 && loggingEnabled) {
        L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
    }

    Options decodingOptions = decodingInfo.getDecodingOptions();
    decodingOptions.inSampleSize = scale;
    return decodingOptions;
}
 
Example 6
Source File: BaseImageDecoder.java    From WliveTV with Apache License 2.0 6 votes vote down vote up
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
	ImageScaleType scaleType = decodingInfo.getImageScaleType();
	int scale;
	if (scaleType == ImageScaleType.NONE) {
		scale = 1;
	} else if (scaleType == ImageScaleType.NONE_SAFE) {
		scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
	} else {
		ImageSize targetSize = decodingInfo.getTargetSize();
		boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
		scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
	}
	if (scale > 1 && loggingEnabled) {
		L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
	}

	Options decodingOptions = decodingInfo.getDecodingOptions();
	decodingOptions.inSampleSize = scale;
	return decodingOptions;
}
 
Example 7
Source File: BaseImageDecoder.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 6 votes vote down vote up
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
	ImageScaleType scaleType = decodingInfo.getImageScaleType();
	int scale;
	if (scaleType == ImageScaleType.NONE) {
		scale = 1;
	} else if (scaleType == ImageScaleType.NONE_SAFE) {
		scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
	} else {
		ImageSize targetSize = decodingInfo.getTargetSize();
		boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
		scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
	}
	if (scale > 1 && loggingEnabled) {
		L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
	}

	Options decodingOptions = decodingInfo.getDecodingOptions();
	decodingOptions.inSampleSize = scale;
	return decodingOptions;
}
 
Example 8
Source File: BaseImageDecoder.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
	ImageScaleType scaleType = decodingInfo.getImageScaleType();
	int scale;
	if (scaleType == ImageScaleType.NONE) {
		scale = 1;
	} else if (scaleType == ImageScaleType.NONE_SAFE) {
		scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
	} else {
		ImageSize targetSize = decodingInfo.getTargetSize();
		boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
		scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
	}
	if (scale > 1 && loggingEnabled) {
		L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
	}

	Options decodingOptions = decodingInfo.getDecodingOptions();
	decodingOptions.inSampleSize = scale;
	return decodingOptions;
}
 
Example 9
Source File: ImageSizeTest.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Test
public void testComputeImageSampleSize_fitInside() throws Exception {
    final ViewScaleType scaleType = ViewScaleType.FIT_INSIDE;
    int result;

    ImageSize srcSize = new ImageSize(300, 100);
    ImageSize targetSize = new ImageSize(30, 10);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(10);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(8);

    srcSize = new ImageSize(300, 100);
    targetSize = new ImageSize(200, 200);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(1);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(1);

    srcSize = new ImageSize(300, 100);
    targetSize = new ImageSize(55, 40);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(5);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(4);

    srcSize = new ImageSize(300, 100);
    targetSize = new ImageSize(30, 40);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(10);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(8);

    srcSize = new ImageSize(5000, 70);
    targetSize = new ImageSize(2000, 30);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(3);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(4);
}
 
Example 10
Source File: ImageSizeTest.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Test
public void testComputeImageSampleSize_centerCrop() throws Exception {
    final ViewScaleType scaleType = ViewScaleType.CROP;
    int result;

    ImageSize srcSize = new ImageSize(300, 100);
    ImageSize targetSize = new ImageSize(30, 10);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(10);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(8);

    srcSize = new ImageSize(300, 100);
    targetSize = new ImageSize(200, 200);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(1);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(1);

    srcSize = new ImageSize(300, 100);
    targetSize = new ImageSize(55, 40);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(2);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(2);

    srcSize = new ImageSize(300, 100);
    targetSize = new ImageSize(30, 30);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(3);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(2);

    srcSize = new ImageSize(5000, 70);
    targetSize = new ImageSize(300, 30);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
    Assertions.assertThat(result).isEqualTo(3);
    result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
    Assertions.assertThat(result).isEqualTo(4);
}
 
Example 11
Source File: BaseImageDecoder.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
protected android.graphics.BitmapFactory.Options prepareDecodingOptions(ImageSize imagesize, ImageDecodingInfo imagedecodinginfo)
{
    ImageScaleType imagescaletype = imagedecodinginfo.getImageScaleType();
    int i;
    android.graphics.BitmapFactory.Options options;
    if (imagescaletype == ImageScaleType.NONE)
    {
        i = ImageSizeUtils.computeMinImageSampleSize(imagesize);
    } else
    {
        ImageSize imagesize1 = imagedecodinginfo.getTargetSize();
        boolean flag;
        if (imagescaletype == ImageScaleType.IN_SAMPLE_POWER_OF_2)
        {
            flag = true;
        } else
        {
            flag = false;
        }
        i = ImageSizeUtils.computeImageSampleSize(imagesize, imagesize1, imagedecodinginfo.getViewScaleType(), flag);
    }
    if (i > 1 && loggingEnabled)
    {
        Object aobj[] = new Object[4];
        aobj[0] = imagesize;
        aobj[1] = imagesize.scaleDown(i);
        aobj[2] = Integer.valueOf(i);
        aobj[3] = imagedecodinginfo.getImageKey();
        L.d("Subsample original image (%1$s) to %2$s (scale = %3$d) [%4$s]", aobj);
    }
    options = imagedecodinginfo.getDecodingOptions();
    options.inSampleSize = i;
    return options;
}
 
Example 12
Source File: ImageSizeTest.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Test
public void testComputeImageSampleSize_fitInside() throws Exception {
	final ViewScaleType scaleType = ViewScaleType.FIT_INSIDE;
	int result;

	ImageSize srcSize = new ImageSize(300, 100);
	ImageSize targetSize = new ImageSize(30, 10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(8);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(200, 200);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(1);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(1);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(55, 40);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(5);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(4);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(30, 40);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(8);

	srcSize = new ImageSize(5000, 70);
	targetSize = new ImageSize(2000, 30);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(3);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(4);
}
 
Example 13
Source File: ImageSizeTest.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
@Test
public void testComputeImageSampleSize_centerCrop() throws Exception {
	final ViewScaleType scaleType = ViewScaleType.CROP;
	int result;

	ImageSize srcSize = new ImageSize(300, 100);
	ImageSize targetSize = new ImageSize(30, 10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(8);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(200, 200);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(1);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(1);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(55, 40);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(2);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(2);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(30, 30);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(3);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(2);

	srcSize = new ImageSize(5000, 70);
	targetSize = new ImageSize(300, 30);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(3);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(4);
}
 
Example 14
Source File: ImageSizeTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testComputeImageSampleSize_fitInside() throws Exception {
	final ViewScaleType scaleType = ViewScaleType.FIT_INSIDE;
	int result;

	ImageSize srcSize = new ImageSize(300, 100);
	ImageSize targetSize = new ImageSize(30, 10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(8);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(200, 200);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(1);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(1);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(55, 40);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(5);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(4);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(30, 40);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(8);

	srcSize = new ImageSize(5000, 70);
	targetSize = new ImageSize(2000, 30);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(3);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(4);
}
 
Example 15
Source File: ImageSizeTest.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Test
public void testComputeImageSampleSize_centerCrop() throws Exception {
	final ViewScaleType scaleType = ViewScaleType.CROP;
	int result;

	ImageSize srcSize = new ImageSize(300, 100);
	ImageSize targetSize = new ImageSize(30, 10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(10);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(8);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(200, 200);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(1);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(1);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(55, 40);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(2);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(2);

	srcSize = new ImageSize(300, 100);
	targetSize = new ImageSize(30, 30);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(3);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(2);

	srcSize = new ImageSize(5000, 70);
	targetSize = new ImageSize(300, 30);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, false);
	Assertions.assertThat(result).isEqualTo(3);
	result = ImageSizeUtils.computeImageSampleSize(srcSize, targetSize, scaleType, true);
	Assertions.assertThat(result).isEqualTo(4);
}