Why does reading image get inverted