For smooth downsampling you need mipmaps!
With Qt 5.3 (which will be released very soon) this will work:
Image {
source: "image_400x400.png"
width: 100
height: 100
mipmap: true
}
For Qt 5.2 you can try the following as an higher-quality alternative to your multisampling approach:
ShaderEffectSource {
id: src
sourceItem: Image { source: "image_400x400.png" }
mipmap: true
}
ShaderEffect {
width: 100
height: 100
property var source: src
}
If you don't need to change the scale of the image dynamically, the optimal approach (for all relevant Qt versions) is this:
Image {
source: "image_400x400.png"
sourceSize.width: 100
sourceSize.height: 100
}
The image will be high-quality downscaled on the CPU and then uploaded to the GPU. Be aware that, because image information is lost, it will look worse when shown at the scale of the original image.
Regarding the smooth
property:
The smooth
property of an Image
enables linear interpolation. It's on by default and it's an improvement over nearest-neighbor interpolation, which is used when smooth = false
; but it doesn't help much for downscaling.
Regarding the antialising
property:
Setting antialiasing = true
doesn't change the quality of the image scaling at all. It just smoothes the edges, which might be important when the image is rotated.