Skip to main content

cImage - A simple image processing library for Python

Installation

If using Thonny, go to Tools -> Manage Packages, then enter cs20-image. This should install both the image module, and the Pillow module (so you can use any type of image you’d like).

If you are not using Thonny, copy image.py to your site-packages directory, or just keep it in the same folder as the Python scripts that import it.

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 (if you are using Thonny, this was installed along with the image module):

  • jpeg

  • gif

  • tiff

  • png

  • etc.

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

Example

import image

win = image.ImageWin(480, 640, "Image Processing")
original_image = image.FileImage('lcastle.gif')

width = original_image.get_width()
height = original_image.get_height()
print(width, height)

original_image.draw(win)
my_image = original_image.copy()

for row in range(height):
    for col in range(width):
         v = my_image.get_pixel(col,row)
         v.red = 255 - v.red
         v.green = 255 - v.green
         v.blue = 255 - v.blue
         my_image.set_pixel(col,row,v)

my_image.draw(win)
print(win.get_mouse())
my_image.save('lcastle-inverted.gif')
print(my_image.to_list())
win.exit_on_click()

Download files

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

Source Distribution

cs20-image-1.5.3.tar.gz (7.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cs20_image-1.5.3-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

cs20_image-1.5.3-py2.py3-none-any.whl (9.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cs20-image-1.5.3.tar.gz.

File metadata

  • Download URL: cs20-image-1.5.3.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cs20-image-1.5.3.tar.gz
Algorithm Hash digest
SHA256 414d9181278c72b91acbd839e51750c4f5427e907a506ec2b6e58551ccb9dd42
MD5 f32d1d464cef8a2f472d51a81c61ef19
BLAKE2b-256 8a485000102abe9aeedb8792d01573aa6aaa84dcf350205b3af18262664bf5fe

See more details on using hashes here.

File details

Details for the file cs20_image-1.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for cs20_image-1.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c23591cb7da8d426a5897f038e6fa1b42a31a5af7868e80cadac2e3b21ac7adf
MD5 0013cf20256cfb6753a0f14f523e2308
BLAKE2b-256 15e020d8bc69508efaa22839211649b4f86b83c0c932212cd06cae0c19b04646

See more details on using hashes here.

File details

Details for the file cs20_image-1.5.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cs20_image-1.5.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 673a074369c7b6296919d53314ff5775d2b5c0f0b32c65eb8bc19f4cbcb5fd9b
MD5 0459b5b220c41c5849c77132e2f38ddd
BLAKE2b-256 bc04ee8ec8fd4560d29c6439c2c95a425f501eceb870a3e6cbc09260dd0eb841

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page