Since it receives a pixelated image, it might be the way you’re formatting/ encode the message that you send through the socket or when you decode the message. It is hard to say, but you can read about the Bytearray send through socket using this link: https://s3-eu-west-1.amazonaws.com/ur-support-site/45989/scriptManual.pdf
And maybe look at this topic: Java socket communication
Hope it helped!