开发者

Automatically Convert PNG to JPG with Python

开发者 https://www.devze.com 2023-02-04 01:57 出处:网络
I\'ve written a Python program to retrieve an image from a URL using msgImage = MIMEImage( urllib2.urlopen(chartURL).read() )

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

精彩评论

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

关注公众号