I was wondering if someone could post an example using PyPNG to read a 48-bit image (16 bit channel R,G, and B), get and display a specific pixel color (say pixel 88 or whatever), change that value, and write it back into the png. I found the documentation to be very sparse, any help would be greatly appreciated.
def readPNG2(f):
r=png.Reader(f)
r.read()
print r.bitdepth
this produces a result of 16. I saved my image out of Photoshop as 16 per channel (48-bit). What am I missing, is this in fact saying 16 bits per channel?
Yes that would mean 16 bits per channel. 16 or 15 bits per pixel is mostly a thing of the past. The docu explains how to load 16bpc into a numpy array.
The API of PyPNG seems to be very low-level, only one step away from directly using libpng from C. (See the libpng manual for more on that. It is an option to do that for a python application, e.g. MyPaint does it via swig extension.)