fixing bug on odd width/height images and make Flip methods as extension methods