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.
精彩评论