Pixel-Level Image Editing

I need to be able to mathematically change the color of pixels in an image from within Blender, but I am having a real hard time figuring out how to do that.

There’s a thread from 2007 about this, but it makes use of classes that don’t seem to be a part of either the Blender API nor the Python.org class repository. For example, the only class “colour” that is part of Python does not have an as_tuple ( ) method that I can spot. In fact, the only reference to as_tuple ( ) that I can find is a set of very old mentions of calling it from an object of class “decimal”.

There’s a thread about reading pixels, but looking at the documentation here I just don’t see how color information is encoded there. It’s a 2d float array, but color values require three floats, not one. … unless there’s a color quantification format that I don’t know?

I’m new to Python and the Blender API, and the project I need this for would already be challenging even if I knew both of those very well. So, I’m in a bit of a crunch to get past the simple part of the most basic operation I need and would really, very, very greatly appreciate it if somebody could toss me a clue here.