handle flipped image output correctly