Python映像替代 [英] Python imaging alternatives
问题描述
我有一个python代码,需要做一些简单的事情到照片:裁剪,调整大小和覆盖水印。我使用PIL,resample / resize结果是TERRIBLE。我使用了imagemagick,界面和命令的设计是将一只猫包装在一个盒子里,然后在键盘上反复扔下一组楼梯。
I have python code that needs to do just a couple simple things to photographs: crop, resize, and overlay a watermark. I've used PIL, and the resample/resize results are TERRIBLE. I've used imagemagick, and the interface and commands were designed by packaging a cat in a box, and then repeatedly throwing it down a set of stairs at a keyboard.
我正在寻找不是PIL或Imagemagick的东西,我可以使用python做简单的,高质量的图像转换。对于这一点,如果命令行界面是好的,它甚至不需要有python绑定。
I'm looking for something which is not PIL or Imagemagick that I can use with python to do simple, high-quality image transformations. For that matter, it doesn't even have to have python bindings if the command line interface is good.
哦,它需要相对平台无关,我们的生产服务器是linux,但我们的一些开发人员在Windows上开发。它不能要求安装一堆愚蠢的gui代码用作库。
Oh, and it needs to be relatively platform agnostic, our production servers are linux, but some of our devs develop on windows. It can't require the installation of a bunch of silly gui code to use as a library, either.
推荐答案
我已使用PIL,重新取样/调整大小的结果为TERRIBLE。
I've used PIL, and the resample/resize results are TERRIBLE.
- 仅使用Image.ANTIALIAS过滤进行缩减操作
- 仅使用Image.BICUBIC
- 请勿在调整大小之前将其转换为RGB颜色模式。 .thumbnail()。 it's crap
- 在保存JPEG时将
quality =
级别设置为适当的值(默认值相当低)
- use only Image.ANTIALIAS filtering for downscaling operations
- use only Image.BICUBIC filtering for upscaling operations.
- remember to convert to 'RGB' colour mode before the resize if you are using a paletted image
- don't use .thumbnail(). it's crap
- set the
quality=
level to something appropriate when saving JPEGs (the default is quite low)
这篇关于Python映像替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!