replaced image.tobytes with tostring