PIL: Image resizing : Algorithm similar to firefox's

前端 未结 4 1995
刺人心
刺人心 2021-02-03 11:35

I\'m getting about the same bad looking resizing from all the 4 algorithms of PIL

>>> data = utils.fetch(\"http://wavestock.com/images/beta-ico         


        
4条回答
  •  终归单人心
    2021-02-03 12:05

    I resized the "original" with Python and found the same results as you did. I also resized the "original" with GIMP and I got the same (if not inferior) quality. This made me suspect that Firefox cheats. Possibly it converts to RGB ("original" mode is indexed color). Thus the following code:

    import Image
    im=Image.open("beta-icon.gif")
    im = im.convert("RGB")
    im=im.resize((36,36), Image.ANTIALIAS)
    im.save("q5.png")
    

    The result is almost as good as that of Firefox.

提交回复
热议问题