Issue in converting the Pixels values to image

opened with what ? You need to tell your viewer how to interpret the data