搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  cImage-master.zip
资料下载链接地址: https://bbs.pinggu.org/a-2100028.html
附件大小:

cImage - A simple image processing library for Python


[hide][/hide]


Installation

copy cImage.py to your site-packages directory.

Usage

This image library is not going to give you fancy high performance operations on images. It allows you to read in an image and manipulate its pixels. Then you can save the new image to a file, or you can display the image in a window. Thats really about it, but its really all you want to do if you are teaching an introductory computer science course.

Image Types Supported

If you have PIL installed on your system:

  • jpeg
  • gif
  • tiff
  • png
  • etc.

If you do not have PIL installed then you are stuck with GIF images only.

If you are using Python 2.6/2.7 I recommend you install Pillow its a simple fork of PIL that you can install with easy_install or pip.

If you are using Python 3 You can get a working version of PIL Here: https://pypi.python.org/pypi/Pillow/2.0.0

Note that if you scroll down to the bottom you will find binary installations for Windows. Linux and Mac users can follow the instructions on the page.

  1. Example

  2. from cImage import *
  3. myimagewindow = ImageWin("Image Processing",600,300)
  4. oldimage = FileImage("lutherbell.jpg")
  5. oldimage.setPosition(0,0)
  6. oldimage.draw(myimagewindow)

  7. width = oldimage.getWidth()
  8. height = oldimage.getHeight()
  9. newim = EmptyImage(width,height)

  10. for row in range(height):
  11. for col in range(width):
  12. oldpixel = oldimage.getPixel(col,row)
  13. ave=(oldpixel.getRed()+oldpixel.getGreen()+oldpixel.getBlue())/3
  14. newim.setPixel(col,row,Pixel(ave,ave,ave))

  15. newim.setPosition(width+1,0)
  16. newim.draw(myimagewindow)

  17. myimagewindow.exitOnClick()
复制代码




    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2026-1-2 10:35