문제

enter image description here

I want to upscale an image using PIL. I have tried all of the antialiasing options, but none of them are right (I actually want no antialiasing at all). I don't want any blur, but a similar effect to texture packs in Minecraft.

This question has been asked before, but in Java: How to upscale an image without it becoming blurry

The solution was Bitmap#createScaledBitmap()

Can somebody give me an equivalent function for Python (please standard library)?

Any help is appreciated.

도움이 되었습니까?

해결책 2

As @martineau pointed out in a comment:

If you want no anitaliasing, just omit the last argument -- i.e. d = c.size((1000, 700)).

Ommiting the last argument solved my problem.

다른 팁

The selected answer does not work with the 2020 API. PIL.Image.BOX is the right filter for upscale without blur, i.e.

from PIL import Image
c = Image.open(example)
d = c.resize((1000,700), resample=Image.BOX)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top