Python映像替代 [英] Python imaging alternatives

查看:226
本文介绍了Python映像替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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.


  1. 仅使用Image.ANTIALIAS过滤进行缩减操作

  2. 仅使用Image.BICUBIC

  3. 请勿在调整大小之前将其转换为RGB颜色模式。
  4. .thumbnail()。 it's crap
  5. 在保存JPEG时将 quality = 级别设置为适当的值(默认值相当低)

  1. use only Image.ANTIALIAS filtering for downscaling operations
  2. use only Image.BICUBIC filtering for upscaling operations.
  3. remember to convert to 'RGB' colour mode before the resize if you are using a paletted image
  4. don't use .thumbnail(). it's crap
  5. set the quality= level to something appropriate when saving JPEGs (the default is quite low)

这篇关于Python映像替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆