python简单实现旋转图片的方法

python简单实现旋转图片的方法,第1张

概述本文实例讲述了python简单实现旋转图片方法。分享给大家供大家参考。具体实现方法如下:

本文实例讲述了python简单实现旋转图片的方法。分享给大家供大家参考。具体实现方法如下:

# rotate an image counter-clockwise using the PIL image library# free from: http://www.pythonware.com/products/pil/index.htm# make sure to install PIL after your regular python package is installedimport Image# open an image file (.bmp,.jpg,.png,.gif)# change image filename to something you have in the working folderim1 = Image.open("Donald.gif")# rotate 60 degrees counter-clockwiseim2 = im1.rotate(60)# brings up the modifIEd image in a vIEwer,simply saves the image as# a bitmap to a temporary file and calls vIEwer associated with .bmp# make certain you have an image vIEwer associated with this file typeim2.show()# save the rotated image as d.gif to the working folder# you can save in several different image formats,try d.jpg or d.png # PIL is pretty powerful stuff and figures it out from the extensionim2.save("d.gif")

希望本文所述对大家的Python程序设计有所帮助。

总结

以上是内存溢出为你收集整理的python简单实现旋转图片的方法全部内容,希望文章能够帮你解决python简单实现旋转图片的方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1202738.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-04
下一篇2022-06-04

发表评论

登录后才能评论

评论列表(0条)

    保存