Issue in converting the Pixels values to image

you would probably need to define the mode but I don't think RGB565 is supported, you probably will need to map to 8 bit RGB before building the image

have you looked at frombytes or frombuffer

PLEASE modify your first post and add code tags.