开发者

Automatically Convert PNG to JPG with Python

I've written a Python program to retrieve an image from a URL using

msgImage = MIMEImage( urllib2.urlopen(chartURL).read() )
msg开发者_如何转开发Root.attach(msgImage)

The image that I get from the URL is in PNG format, but I would like to embed a JPG version of it. Is there a simple way to automatically convert the PNG msgImage into JPG for smaller attachments?

Thanks for reading. Any help is greatly appreciated.


You can use PIL: http://www.pythonware.com/products/pil/ It is easy and it has a lot of documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜