I am attempting to improve the performance of image resizing in C#. This StackOverflow answer provided some excellent pointers for improving performance.
I found these tips make a difference:
- Set pixel format to
PixelFormat.Format32bppPArgbwhen creating a Bitmap.
However, the last piece of advice reduces the quality when resizing. This is particularly bad when creating thumbnails.
So how do the different interpolation modes compare against each other in performance?
(lower is better)
But how do they compare in image quality? I have scaled an image to 10% of it’s original size using each technique (slowest first).
It seems to me that the sweet spot is anything starting with ‘High’. These seem to have a good enough quality, and an acceptable performance. The
NearestNeighbor is really ugly, but if you want pure performance, or you’re not making a big difference to the scale, you might get away with it.