Skip to main content

Image manipulation library for media computation education

Project description

cImage - A simple image processing library for Python

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-hypernode.com/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.

Example

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

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

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

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

myimagewindow.exitOnClick()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cImage-1.4.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

cImage-1.4.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file cImage-1.4.1.tar.gz.

File metadata

  • Download URL: cImage-1.4.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cImage-1.4.1.tar.gz
Algorithm Hash digest
SHA256 5222ccff7f6ce00af9e07f7e1bc3ad9efa46ebbaeb7aaaad5b94ead47013dbee
MD5 e361220ce88e57ee5d021b1ad7383a35
BLAKE2b-256 c3e7166f3d0c788b29021b9cf966eca88c48e2b060b93e44dc18baa8e7e68f9b

See more details on using hashes here.

File details

Details for the file cImage-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cImage-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4ea113437943036cdf618ca5ee0acc7b15296898e13d523867fe8ca5a9a802
MD5 c4757f6f8e8bcd9da72d9d0ca815793f
BLAKE2b-256 dd7171dc8f94a6e3da403b95e57a24127ce6b5fa797f541b75db333332bc7794

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page