LEMirroredImagePicker 0.1.0

LEMirroredImagePicker 0.1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release May 2015

Maintained by Lucas Eduardo.



  • By
  • Lucas Eduardo

What is this

When using the UIImagePickerController, some of you must have noticed that, by default, the photo taken by the front camera is mirrored.

And even if you just invert the image taken in the delegate, the image displayed as preview by the UIImagePickerController will be still mirrored, resulting in a odd experience by the user.

See the example of UIImagePickerController's default front camera photo below:

image 1 image 2

And now used together with the LEMirroredImagePicker:

image 1 image 2

Install

Manually

Drag and copy the two files in the LEMirroredImagePicker folder into your project, or add it as a git submodule.

How to use

LEMirroredImagePicker is ridiculously easy to use. All you need to do is invoke the two lines of code below:

#import "LEMirroredImagePicker.h"

(..)
@property(nonatomic) LEMirroredImagePicker *mirrorFrontPicker;
(..)

self.mirrorFrontPicker = [[LEMirroredImagePicker alloc] initWithImagePicker:pickerController];
[self.mirrorFrontPicker mirrorFrontCamera];

(..)

And thats it. Now the images taken by the front camera shown in the preview will be equal the ones the saw in the camera. See a complete example, with the UIImagePickerController, below:

UIImagePickerController *pickerController = [UIImagePickerController new];
pickerController.delegate = self;

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
    pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    pickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
}
else
{
    pickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}

self.mirrorFrontPicker = [[LEMirroredImagePicker alloc] initWithImagePicker:pickerController];
[self.mirrorFrontPicker mirrorFrontCamera];

[self presentViewController:pickerController animated:YES completion:nil];

Collaborate

Liked the project? Is there something missing or that could be better? Feel free to contribute :)

  1. Fork it

  2. Create your branch git checkout -b name-your-feature

  3. Commit it git commit -m 'the difference'

  4. Push it git push origin name-your-feature

  5. Create a Pull Request

Author

Lucas Eduardo, [email protected]

License

LEMirroredImagePicker is available under the MIT license. See the LICENSE file for more info.