# Capture Image Orientation

**URL:** <https://forum.xojo.com/t/capture-image-orientation/70700>\
**Category:** iOS\
**Created:** [June 13, 2022, 12:14pm UTC](https://forum.xojo.com/t/capture-image-orientation/70700 "2022-06-13T12:14:16Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [June 20, 2022, 4:33am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/21 "2022-06-20T04:33:24Z")

</div>

Jason, thank you very much! This almost works a treat! You do need to change a few iosViews as well and I don’t think the editedImage needs to change, but the image comes across perfect! The only snag is even though the PicturePickerController.sourceType is set to UIKit.UIImagePickerController.Source.Camera, it brings you to the photo library and I can’t get it to use the Camera

---

<div class="post-metadata">

**Author:** ![Jason\_Tait](https://forum.xojo.com/user_avatar/forum.xojo.com/jason_tait/32/5896_2.png) [@Jason\_Tait](https://forum.xojo.com/u/Jason_Tait)\
**Post date:** [June 20, 2022, 6:37am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/22 "2022-06-20T06:37:14Z")

</div>

Chris check the Source enumeration in the UIImagePickerController and make sure that Camera = 1 and PhotoLibrary = 0.

```auto
Public Enum Source
Camera = 1
PhotoLibrary = 0
SavedPhotoAlbum = 2
End Enum

```

---

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [June 20, 2022, 6:51am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/23 "2022-06-20T06:51:34Z")

</div>

Thanks Jason - Ya, that’s what they’re set to…

---

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [June 21, 2022, 4:16am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/24 "2022-06-21T04:16:41Z")

</div>

Jason this is the sample project I’m using to test your code:

[Download Take Photo](http://46.22.139.144/www/TakePhoto.zip)

Thanks for any help

---

<div class="post-metadata">

**Author:** ![Jason\_Tait](https://forum.xojo.com/user_avatar/forum.xojo.com/jason_tait/32/5896_2.png) [@Jason\_Tait](https://forum.xojo.com/u/Jason_Tait)\
**Post date:** [June 21, 2022, 12:38pm UTC](https://forum.xojo.com/t/capture-image-orientation/70700/25 "2022-06-21T12:38:15Z")

</div>

Chris I haven’t had a chance to compare the code to work out what might be different, but just check that you’re using a real device as the iOS Simulator doesn’t support the camera.

---

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [June 21, 2022, 1:17pm UTC](https://forum.xojo.com/t/capture-image-orientation/70700/26 "2022-06-21T13:17:32Z")

</div>

Thanks Jason. I appreciate that. Yes, I’m trying it on an iPhone. Thanks very much for the time you’ve already offered.

If anyone else want’s to check the code and has the time, I’d really appreciate it. It works perfect except it’s calling the photo library and not the camera. It’s basically iOSkit with the small change Jason suggested to changing originalImage to a picture and Jason’s code.

Thanks for any help

---

<div class="post-metadata">

**Author:** ![Jason\_Tait](https://forum.xojo.com/user_avatar/forum.xojo.com/jason_tait/32/5896_2.png) [@Jason\_Tait](https://forum.xojo.com/u/Jason_Tait)\
**Post date:** [June 22, 2022, 10:05am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/27 "2022-06-22T10:05:13Z")

</div>

Chris I notice in the test project you are missing the camera capability setting. It might be the case that the UIImagePickerController defaults to the photo library if it can’t request camera permissions from the user.

To add this, click on iOS within Build Settings, then click on the gear icon and switch on “Camera Access”. You might also need to click on Options and enter an explanation for the plist which will be displayed for the user when they first launch the camera and grant permission.

 ![image](https://forum.xojo.com/uploads/default/original/2X/d/dd7bada2b00e23ffaf80bd3bef4fea400ac49a88.png)

---

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [June 23, 2022, 6:09am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/28 "2022-06-23T06:09:54Z")

</div>

Hi Jason. Thanks very much for looking at this, but alas, it’s not the answer. I had tried it in the past, but set it back to default as it had no effect. Funnily enough, using the MobileImagePicker doesn’t seem to require Camera Access switched ON…

---

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [June 25, 2022, 5:13am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/29 "2022-06-25T05:13:20Z")

</div>

Hi,

I’m just reaching out to the Community again, hoping someone in the know has a few minutes to spare to have a look this project :

[Download TakePhoto Project](http://46.22.139.144/www/TakePhoto.zip)

to see why the Photo Library is called instead of the Camera.

Chris

I appreciate any help at all to point me in the right direction

---

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [July 5, 2022, 9:03am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/30 "2022-07-05T09:03:07Z")

</div>

Hi. Reaching out again, hoping someone can help - Is there anyone available within Xojo that might be able to help me get around one of their bugs?

Thanks

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [July 5, 2022, 11:03am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/31 "2022-07-05T11:03:05Z")

</div>

Did you add the key NSCameraUsageDescription in your Info.plist?  
It’s required for camera access. (could be done using the switch on, make sure you set a good message in the “Options…”)

---

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [July 5, 2022, 11:36am UTC](https://forum.xojo.com/t/capture-image-orientation/70700/32 "2022-07-05T11:36:45Z")

</div>

Thanks DerkJ. Ya, I do. I have it in the Info and I’ve tried turning ON ‘Camera Access’ capabilities in the project with ‘Uses your Camera to scan barcodes and take photographs’ in the Options.

When PicturePickerController.PresentInView is called, it still behaves as if PicturePickerController.sourceType is set to UIKit.UIImagePickerController.Source.PhotoLibrary, rather than UIKit.UIImagePickerController.Source.Camera

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [July 5, 2022, 12:00pm UTC](https://forum.xojo.com/t/capture-image-orientation/70700/33 "2022-07-05T12:00:31Z")

</div>

why not use:

[https://documentation.xojo.com/api/user\_interface/mobile/mobileimagepicker.html](https://documentation.xojo.com/api/user_interface/mobile/mobileimagepicker.html)

---

<div class="post-metadata">

**Author:** ![Chris\_O\_Brien](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_o_brien/32/452_2.png) [@Chris\_O\_Brien](https://forum.xojo.com/u/Chris_O_Brien)\
**Post date:** [July 5, 2022, 12:49pm UTC](https://forum.xojo.com/t/capture-image-orientation/70700/34 "2022-07-05T12:49:22Z")

</div>

Because there is a longterm bug in this control which is unaware of the camera orientation and distorts the image unless the iPhone is only in landscape position

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [July 5, 2022, 12:54pm UTC](https://forum.xojo.com/t/capture-image-orientation/70700/35 "2022-07-05T12:54:10Z")

</div>

Note image picker only works in portrait mode as far as i know.  
Other camera options you can check the FB requests and add a thumbs up. 👍

[Previous page](https://forum.xojo.com/t/capture-image-orientation/70700.md?page=1)
