Skip to main content

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

Metadata

Release files for byuimage 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for byuimage 0.5.0
File Size Uploaded Provenance Actions
byuimage-0.5.0.tar.gz 3.5 kB With provenance Details for byuimage-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for byuimage 0.5.0
File Interpreter ABI Platform Actions
byuimage-0.5.0-py3-none-any.whl Python 3 none any Details for byuimage-0.5.0-py3-none-any.whl

Total release size: 7.6 kB

Release files / byuimage-0.5.0.tar.gz

Download URL byuimage-0.5.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7a304ecc964ff785882a4d88060b44d8818dc8e72aeff8be4dc06cb591f7f7ed
BLAKE2b-256 checksum
How to use checksums
570dbe620de5a07e33f6fdf626ddc442c184d45a538ebef47f67e568204bd933
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2025.

Transparency log

Release files / byuimage-0.5.0-py3-none-any.whl

Download URL byuimage-0.5.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ac9c20d693a6c530bfe3da4d84afff816c88f154ba7d68ded0ba3dd7cb13f5a
BLAKE2b-256 checksum
How to use checksums
129a69eff4a4a40571f33f90436324222acc212d6dc965a978418d0873503b55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2025.

Transparency log

Security for byuimage 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for byuimage-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page