Sort out image orientation for loading from files.