简体   繁体   中英

Python 2D image generation

What are some of the better libraries for image generation in Python? If I were to implement a GOTCHA (for example's sake), thereby having to manipulate an image on the pixel level, what would my options be? Ideally I would like to save resulting image as a low-resolution jpeg, but this is mere wishing, I'll settle for any common image format.

Thank you for your attention.

The Python Imaging Library (PIL) is the de facto image manipulation library on Python. You can find it here , or through easy_install or pip if you have them.

Edit: PIL has not been updated in a while, but it has been forked and maintained under the name pillow . Just install it this way in a shell:

pip install Pillow

The import statements are still the same as PIL (eg, from PIL import image ) and is backward compatible.

Pillow is a fork of PIL that is still actively developed. While PIL is not dead it has been a number of years since the last release.

If you should generate text or other vector based images (and then save to .png or .jpg), you could also consider Cairo (PyCairo, in this case). I use it a lot. Otherwise, for pixel-level manipulation, PIL is the obvious choice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM