Convert image to byteArray