Scaled image quality depends on incoming image dimensions, scaling algorithm and "quality" parameter for JPEG format. JImageFilter supports four scaling algorithms. The table below sums up the differences between each:
Scaling algorithm |
Image quality |
Scaling speed |
Memory usage |
ImageIO subsample |
Low |
Very fast |
Very low |
ImageIO on-step bicubic |
Good |
Fast |
Low |
ImageIO multi-step bilinear |
Better |
Medium |
Medium |
AWT |
Best |
Slow |
Low |
|
Default scaling.properties is setup with ImageIO on-step bicubic because it provides the best quality/speed ratio. However, if you need quality first then you should use AWT implementation (i.e. uncomment impl=awt in scaling.properties). Even if twice slower, it is the recommended one when scaling large images.
Sample1: Reduce image dimensions by around 4.
Here is a sample below of a scaled image. Original image (1132x1696, 2139 KB, RGB 24bits) was scaled into 320x480. Notice how "SHERIFF" edges are differents between ImageIO bicubic to the two others. Multi-step bilinear and AWT are quite similar.
Algorithm: ImageIO on-step bicubic
impl=ImageIO
Time to scale: 1.6 seconds
Scaled size: 27 KB
Default quality parameter (0.75). |
|
Algorithm: ImageIO multi-step bilinear
impl=ImageIO
multistep=true
Time to scale: 1.9 seconds
Scaled size: 22 KB
Default quality parameter (0.75). |
|
Algorithm: AWT
impl=awt
Time to scale: 3.1 seconds
Scaled size: 21 KB
Default quality parameter (0.75). |
|
Sample2: Reduce image dimensions by around 9.
Here is a sample below of a scaled image with an important moiré pattern. Original image (2718x4077, 3551 KB, RGB 24bits) was scaled into 320x480.
Algorithm: ImageIO on-step bicubic
impl=ImageIO
Time to scale: 6.1 seconds
Scaled size: 37KB
Default quality parameter (0.75). |
|
Algorithm: ImageIO multi-step bilinear
impl=ImageIO
multistep=true
Time to scale: 8.4 seconds
Scaled size: 25KB
Default quality parameter (0.75). |
|
Algorithm: AWT
impl=awt
Time to scale: 12.1 seconds
Scaled size: 25KB
Default quality parameter (0.75). |
|
Note: Performance tests have been done with an old computer configuration (JRE 1.5, Windows 2000, One CPU 1GHz). It should be quite faster on a recent box.
|