Image displayed upside down in mac preview, but displayed right side up in the browser

风格不统一 提交于 2019-12-25 00:18:58

问题


A jpg is rendered upside down on my mac but correctly in a safari browser on the same mac. What is the orientation data that is not correctly being read? Is it in the EXIF?


回答1:


Here's how to display it with the correct orientation

  if (image.imageOrientation != UIImageOrientationUp)
  {            
    image = [UIImage 
              imageWithCGImage: image.CGImage 
              scale: 1 
              orientation: UIImageOrientationUp];
  }

based on an answer by ravin Save UIImage, Load it in Wrong Orientation



来源:https://stackoverflow.com/questions/11319861/image-displayed-upside-down-in-mac-preview-but-displayed-right-side-up-in-the-b

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!