Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Capture front camera photo is vertically flipped after being saved #213

Closed
dannyhertz opened this issue Dec 21, 2014 · 14 comments
Closed

Capture front camera photo is vertically flipped after being saved #213

dannyhertz opened this issue Dec 21, 2014 · 14 comments
Labels

Comments

@dannyhertz
Copy link

I'm trying to write a photo to the photo album and my front facing photos are always vertically flipped (until it is slightly zoomed). A GIF to help:

img_7551

I've tried saving the UIImage with the orientation set to image.imageOrientation like so:

[assetsLibrary writeImageToSavedPhotosAlbum:currentImage.CGImage orientation:(ALAssetOrientation)currentImage.imageOrientation completionBlock:nil];

I've also tried to save the PBJVisionPhotoJPEGKey data with the PBJVisionPhotoMetadataKey dictionary and am getting the same results:

NSDictionary *currentMediaMetadata = currentMediaDict[PBJVisionPhotoMetadataKey];
NSData *currentMediaData = currentMediaDict[PBJVisionPhotoJPEGKey];

[assetsLibrary writeImageDataToSavedPhotosAlbum:currentMediaData metadata: currentMediaMetadata completionBlock:nil];

vision.cameraOrientation is set to 0 and vision.mirroringMode is set to PBJMirroringAuto at the time if that helps.

Any help would be appreciated!

@piemonte
Copy link
Owner

@dannyhertz hey, that's interesting, thanks for reporting.

my guess is that it could be the thumbnail which transitions to the actual photo once you start zooming.

@piemonte piemonte added the bug label Dec 24, 2014
@dannyhertz
Copy link
Author

Interesting! I tried debugging this for a few hours the other day by commenting out all thumbnail generating code and trying to reduce the path from snapshot to camera roll and was not able to properly save a front facing photo without some form of corruption.

Are you able to successfully save a front facing photo?

@paoloandrea
Copy link

I've the same problem.
Please can you help me.

@piemonte piemonte modified the milestone: 0.4.1 Jan 2, 2015
@zipnadarien
Copy link

FWIW, in my app, I take the photo and combine it w/ another image and then save that new image to file. In this case, any image taken from the front camera is not flipped.

@piemonte
Copy link
Owner

at some point a bug got introduced where the orientation just isn't being set properly on the image, the camera default is 90 CCW (landscape left). so when that get's mirrored in it's vertical, it flips it upside-down. will try hunt it down where the orientation is getting reset. thanks for all the feedback.

@michal-czw
Copy link

@piemonte Hi, did you find out what is causing this bug? I found out that imageSamplerBuffer's orientation is set to LeftMirrored even if I set Portrait for PBJ

@piemonte piemonte modified the milestones: 0.4.1, 0.4.2 Apr 8, 2015
@anfriis
Copy link

anfriis commented Mar 8, 2016

This issue is still open, using the latest version 0.4.2.
Any news about a fix?

@lmick002
Copy link

lmick002 commented Apr 3, 2016

@zipnadarien Do you mind sharing your solution?

@zipnadarien
Copy link

Larry M - been a long time since I worked on that code, give me a few weeks
and I'll check what I did and respond.

On Sun, Apr 3, 2016 at 1:31 AM, Larry M notifications@github.com wrote:

@zipnadarien https://github.com/zipnadarien Do you mind sharing your
solution?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#213 (comment)

@lmick002
Copy link

lmick002 commented Apr 5, 2016

Thanks @zipnadarien

@zipnadarien
Copy link

It's been a year since I last worked on my app (slo-mo booth). As I mentioned in my post from Jan2015, when I grab a photo, I insert it into another image. I'm creating a filmstrip of 4 photos in the final image and that's what I save. I reviewed my code for a bit today and don't see that I'm doing anything different or did any kind of mod to the original PBJVision code. So....either I did a mod that I don't remember (didn't make any comments in the code or my repo) or I didn't do anything cause I don't see the bug for how I'm using the photo feature.

@harirao002
Copy link

I've the same problem. Any updates?

@harirao002
Copy link

@piemonte : Did you find any solution for this issue?

@piemonte piemonte removed this from the 0.4.3 milestone Jan 31, 2017
@harirao002
Copy link

Try this one :

if (objPhoto.imageOrientation == UIImageOrientationLeftMirrored) {

    imageToDisplay =
    [UIImage imageWithCGImage:[objPhoto CGImage]
                        scale:[objPhoto scale]
                  orientation: UIImageOrientationRight];
}

My issue is fixed by using above code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants