fix issue #1 for flipped tiles

fix issue #1 for flipped tiles
using PIL