Skip to main content

Simple Image processing library, used for teaching people how to program

Project description

BYU Simple Image Library

This is a simple library for interacting with images. It is used for instruction in an introductory programming class, CS 110 Introduction to Programming, and CS 111 Introduction to Computer Science at Brigham Young University.

The interface for this library is based off a similar library developed at Stanford University, but was developed independently.

Importing the Library

from byuimage import Image

Creating an image

image = Image(filename)
  • creates a new image from a filename
image = Image.blank(width, height)
  • creates a new, blank, white image with the given width and height

Image properties

image.height
  • returns image height in pixels
image.width
  • returns image width in pixels

Iterating over pixels in an image

for pixel in image:
  • loops over all pixels, from left to right and top to bottom
for y in range(image.height):
    for x in range(image.width):
  • loops over all pixels, from left to right and top to bottom

Getting and setting pixels

pixel = image.get_pixel(x,y)
  • gets the pixel at the given (x,y) coordinate
pixel.red = value
pixel.green = value
pixel.blue = value
  • Sets the pixel red, green, or blue value to the given value
pixel.color = (10, 10, 10)

pixel.color = otherpixel.color
  • Sets the pixel red, green, and blue values to the given tuple or pixel color

Showing and saving images

image.show()
  • shows an image
image.save(filename)
  • saves an image

Credits

The sample image used here is a photo from Mike Newbry, using the Unsplash License, and is available for free at https://unsplash.com/photos/BTE-k0V19Gw

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

byuimage-0.5.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

byuimage-0.5.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file byuimage-0.5.0.tar.gz.

File metadata

  • Download URL: byuimage-0.5.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for byuimage-0.5.0.tar.gz
Algorithm Hash digest
SHA256 7a304ecc964ff785882a4d88060b44d8818dc8e72aeff8be4dc06cb591f7f7ed
MD5 3404a77f3b5923d95eda79830cc6c75f
BLAKE2b-256 570dbe620de5a07e33f6fdf626ddc442c184d45a538ebef47f67e568204bd933

See more details on using hashes here.

Provenance

The following attestation bundles were made for byuimage-0.5.0.tar.gz:

Publisher: publish.yml on byu-cs111/simpleimage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file byuimage-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: byuimage-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for byuimage-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ac9c20d693a6c530bfe3da4d84afff816c88f154ba7d68ded0ba3dd7cb13f5a
MD5 9e54b32e5c88524b9c4760e53b2c3547
BLAKE2b-256 129a69eff4a4a40571f33f90436324222acc212d6dc965a978418d0873503b55

See more details on using hashes here.

Provenance

The following attestation bundles were made for byuimage-0.5.0-py3-none-any.whl:

Publisher: publish.yml on byu-cs111/simpleimage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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