Flipping image for write