Fix flipped images on OS X.
Merge branch 'master' into imageRep