The dangers behind image resizing (2021)
Problems with image resizing is a much deeper rabbit hole than this. Some important talking points:<p>1. The form of interpolation (this article).<p>2. The colorspace used for doing the arithmetic for interpolation. You most likely want a linear colorspace here.<p>3. Clipping. Resizing is typically done in two phases, once resizing in x then in y direction, not necessarily in this order. If the kernel used has values outside of the range [0, 1] (like Lanczos) and for intermediate results you only capture the range [0,1], then you might get clipping in the intermediate image, which can cause artifacts.<p>4. Quantization and dithering.<p>5. If you have an alpha channel, using pre-multiplied alpha for interpolation arithmetic.<p>I'm not trying to be exhaustive here. ImageWorsener's page has a nice reading list[1].<p>[1] <a href="https://entropymine.com/imageworsener/" rel="nofollow">https://entropymine.com/imageworsener/</a>