Python Imaging Library保存功能语法 [英] Python Imaging Library save function syntax

查看:87
本文介绍了Python Imaging Library保存功能语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为很简单,但是本质上我需要知道PIL上save函数的语法是什么.帮助真的很模糊,我在网上找不到任何东西.任何帮助都会很棒,谢谢:).

解决方案

来自 PIL手册附录列出了受支持的不同文件类型.在某些情况下,为save提供了选项.例如,在 JPEG文件格式页面上,我们被告知保存支持

  • quality
  • optimize
  • progressive

带有有关每个选项的注释.

Simple one I think but essentially I need to know what the syntax is for the save function on the PIL. The help is really vague and I can't find anything online. Any help'd be great, thanks :).

解决方案

From the PIL Handbook:

im.save(outfile, options...)

im.save(outfile, format, options...)

Simplest case:

im.save('my_image.png')

or whatever. In this case, the type of the image will be determined from the extension. Is there a particular problem you're having? Or specific saving option that you'd like to use but aren't sure how to do so?

You may be able to find additional information in the documentation on each filetype. The PIL Handbox Appendixes list the different file types that are supported. In some cases, options are given for save. For example, on the JPEG file format page, we're told that save supports

  • quality
  • optimize, and
  • progressive

with notes about each option.

这篇关于Python Imaging Library保存功能语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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