0

I'm facing a very odd thing here... When I take one photo and then I select it into my iOS app. I'm doing some image filtering. I would like to use the following code to get its width and height. But interesting thing is method "CGImageGetWidth" would return the photo's height, and method "CGImageGetHeight" would return width. I don't know why. If I just save one image into my album from web pages, and then I put it in my iOS app, then it works well.

CGImageRef cgimage = image.CGImage;

size_t width  = CGImageGetWidth(cgimage);
size_t height = CGImageGetHeight(cgimage);

Someone can help me?

Andy Yi
  • 43
  • 4
  • Are you sure you aren't rotating it from portrait to landscape as you are saving it? There is an option that does that. – HalR Aug 01 '13 at 03:19
  • No, I didn't rotate the simulator and devices. – Andy Yi Aug 01 '13 at 04:36
  • 1
    No, I mean that you can save the images in landscape orientation. look at this answer http://stackoverflow.com/a/10601175/793607 – HalR Aug 01 '13 at 05:23
  • Thank you very much. I think this is what I really need. I would try that code tonight. Thanks again. :) – Andy Yi Aug 01 '13 at 06:00
  • HalR, thank you very much. I tried some code from the link you gave me. It works perfectly in my code. Thank you very very much. :) – Andy Yi Aug 01 '13 at 14:03
  • That's great! I'm glad for you. – HalR Aug 01 '13 at 14:23

0 Answers0