How do I do high quality scaling of a image?

后端 未结 11 1005
温柔的废话
温柔的废话 2021-01-30 15:19

I\'m writing some code to scale a 32 bit RGBA image in C/C++. I have written a few attempts that have been somewhat successful, but they\'re slow and most importantly the qualit

11条回答
  •  -上瘾入骨i
    2021-01-30 15:35

    Now that I see your original image, I think that OpenGL is using a nearest neighbor algorithm. Not only is it the simplest possible way to resize, but it's also the quickest. The only downside is that it looks very rough if there's any detail in your original image.

    The idea is to take evenly spaced samples from your original image; in your case, 55 out of 256, or one out of every 4.6545. Just round the number to get the pixel to choose.

提交回复
热议问题