ios - AVCaptureStillImageOutput Image orientation is wrong -


i'm running avcapturesession still images on user action (button press). i've problem orientation rotated 90 degree although set values :

- (void)setupavcapture {     //capture session     _session = nil;     _session = [[avcapturesession alloc] init];     [_session setsessionpreset:avcapturesessionpreset1280x720]; //preview view     self.previewlayer = nil;     self.previewlayer = [[avcapturevideopreviewlayer alloc] initwithsession:_session];     [self.previewlayer setvideogravity:avlayervideogravityresizeaspectfill];      calayer *rootlayer = [_previewview layer];     [rootlayer setmaskstobounds:yes];     [[_previewlayer connection]setvideoorientation:avcapturevideoorientationportrait]; } 

and

- (ibaction)captureimage:(id)sender {      avcaptureconnection *stillimageconnection = [stillimageoutput connectionwithmediatype:avmediatypevideo];     [stillimageconnection setvideoorientation:avcapturevideoorientationportrait];     [stillimageoutput capturestillimageasynchronouslyfromconnection:stillimageconnection completionhandler:^(cmsamplebufferref imagedatasamplebuffer, nserror *error) {         if (imagedatasamplebuffer != nil) {             nsdata *imagedata = [avcapturestillimageoutput jpegstillimagensdatarepresentation:imagedatasamplebuffer];             cgdataproviderref dataprovider = cgdataprovidercreatewithcfdata((cfdataref)imagedata);             cgimageref cgimageref = cgimagecreatewithjpegdataprovider             (dataprovider, nil, yes, kcgrenderingintentdefault);              _capturedimage = [uiimage imagewithcgimage:cgimageref scale:1.0 orientation:uiimageorientationup];         }     }]; 

thanks in advance

try uiimageorientationleft orientation.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -