Week 1: Getting Started with JES and Digital Imaging

This week, we got started using JES, a Jython/Python IDE for students to learn how to process and transform digital images. It has been a while since I have coded anything in Python, aside from a few leisure electronics projects that use CircuitPython. It was a little bit like coming home since Python is the first programming language I understood, as I had to learn it for my computational linguistics courses. There’s a bit of nostalgia attached to Python.

I learned how to use several of the built-in functions in JES, such as makeImage to create a Picture object out of specific image file, given its path. A Picture object is an abstraction of an image file. It represents data related to the image such as:

  • a list of all of the image’s pixels (retrievable with the accessor function getPixels)
  • the image’s height (accessed by getHeight)
  • the image’s width (accessed by getWidth)

There are mutator functions that can modify the state of a Picture object such as:

  • repaint, updates/redraws an opened Picture object to reflect changes to its state
  • addText, which takes five parameters–reference of the Picture object, the x and y positions of where to start adding text, the string of text itself, and the Color the text should be.

Each pixel of an image is also represented as a Pixel object

We used the getColor accessor to get the RGB values of a particular pixel and the setColor mutator to change the RGB values of a pixel. These functions were instrumental in building our own functions that would produce different effects, such as the ones illustrated below:

Original photo (CSUMB landscape)

Grayscale version produced by betterBnW() function

Negative version produced by makeNegative() function

No struggles or difficulties this week!

Leave a Reply

Your email address will not be published.