This simple implementation grants read/write access to the underlying pixel buffer of an ImBuf. If a float buffer exists, it returns a buffer for the float buffer, otherwise it uses the byte buffer. Here's a basic example of how to use it:
import imbuf
# load an iamge
im = imbuf.load('C:/some-file.png')
# grant memoryview access to underlying buffer
mv = memoryview(im)
# invert all values
for i in range(len(mv)):
mv[i] = 255 - mv[i]
# write out the modified imbuf
imbuf.write(im)