How to read an image pixels in a composer node to dump to a composer operation?

I’d like to get all the different colors of an input image and dump the table in an operation. How would you do it?

I’m trying to do a color remap / dithering composing node. I’ve got the node to appear in blender, but I’m kind of stuck on how to read the colors from the color map image. Any suggestion?

I’ve managed to do it with a WriteBufferOperation and a ReadBufferOperation.