PIL:Image.draft - 我可以使用哪些模式? [英] PIL: Image.draft -- what are the modes that I can use?

查看:160
本文介绍了PIL:Image.draft - 我可以使用哪些模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在python 2.4.1上有PIL 1.1.5,我试图获得一个较小的

(文件大小)的图像。


例如:

im = ImageGrab.grab()

im.save(" tmp.gif")----约1.7mb

im.save(" tmp.jpeg")----约290kb


无论如何我想将图像保存为GIF,但没有它是这样

大....所以我认为Image.draft方法将是我想要的b $ b ....


im.draft(模式,大小)


配置图像文件加载器,使其返回图像版本

尽可能匹配给定的模式和大小。对于

示例,您可以使用此方法在加载时将颜色JPEG转换为灰度

,或者从PCD文件中提取128x192版本。


......我可以使用什么'模式'?还是有另一种缩小图像大小的方法(除了调整大小)?


谢谢

I have PIL 1.1.5 on python 2.4.1 and I am attempting to get a smaller
(file size) of an image.

for example:
im = ImageGrab.grab()

im.save("tmp.gif") ---- about 1.7mb
im.save("tmp.jpeg") ---- about 290kb

anyways I want to save the image as a GIF, but not have it be so
large....so I thought that the Image.draft method would be what I
wanted....

im.draft(mode, size)

Configures the image file loader so it returns a version of the image
that as closely as possible matches the given mode and size. For
example, you can use this method to convert a colour JPEG to greyscale
while loading it, or to extract a 128x192 version from a PCD file.

......what ''modes'' can I use? or is there another way to shrink the
size of the image (other than resizing it)?

thanks

推荐答案

" abcd"写道:
"abcd" wrote:

>我在python 2.4.1上有PIL 1.1.5并且我试图获得更小的

(文件大小)一个图像。


例如:

im = ImageGrab.grab()


im.save (" tmp.gif")----约1.7mb

im.save(" tmp.jpeg")----约290kb


反正我想把图像保存为GIF,但没有它是如此

大....所以我认为Image.draft方法将是我

想要....
>I have PIL 1.1.5 on python 2.4.1 and I am attempting to get a smaller
(file size) of an image.

for example:
im = ImageGrab.grab()

im.save("tmp.gif") ---- about 1.7mb
im.save("tmp.jpeg") ---- about 290kb

anyways I want to save the image as a GIF, but not have it be so
large....so I thought that the Image.draft method would be what I
wanted....



GIF非常不适合现代机器上的截图。你有没有想过使用PNG考虑



甚至更好,Flash?


这里是一个工具让你使用VNC捕获屏幕,然后将结果转换为flash动画:

http://www.unixuser.org/~euske/vnc2swf/


im.draft(模式,大小)


配置图像文件加载器,使其返回图像版本

尽可能匹配给定的模式和大小。对于

示例,您可以使用此方法在加载时将颜色JPEG转换为灰度

,或者从PCD文件中提取128x192版本。
im.draft(mode, size)

Configures the image file loader so it returns a version of the image
that as closely as possible matches the given mode and size. For
example, you can use this method to convert a colour JPEG to greyscale
while loading it, or to extract a 128x192 version from a PCD file.



请注意使用loader这个词。和加载。草稿用于加载图片时加速图片,而不是在存储图片时压缩图片。


< / F>


Fredrik Lundh写道:
Fredrik Lundh wrote:

GIF非常不适合现代机器上的屏幕截图。你用

考虑使用PNG吗?


甚至更好,Flash?
GIF is horribly unsuitable for screenshots on modern machines. have you
considered using PNG ?

or even better, Flash?



我试图拍摄截图并将它们制作成动画

GIF,然而,将它们放入Flash电影中会很酷....任何想法

如何使用python进行操作? (windows,可能是linux

以后)

well I am trying to take screenshots and make them into an animated
GIF, however, putting them into a Flash movie would be cool....any idea
how to go about doing either with python? (windows, possibly linux
later)


哦和vnc2swf不是一个选项,我不能设置vnc

服务器等只需要使用python(和必要的包)。


动画gif可能是我假设的最好。

oh and vnc2swf would not be an option, i cant be setting up a vnc
server, etc. just need to use python (and necessary packages).

animated gif would probably be best i am assuming.


这篇关于PIL:Image.draft - 我可以使用哪些模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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