ios - Swift - Saving images as bitmap -
i trying save image bitmap using avfoundation. right using jpeg, , wondering need change in order save image bitmap. side note - plan on storing byte[] onto our google app engine , device (android or ios) need image, able pull byte[] database , convert image on device. valid way of going storing images? if not suggest?
here code saving image jpeg
@ibaction func didpresstakephoto(sender: anyobject) { if let videoconnection = stillimageoutput!.connectionwithmediatype(avmediatypevideo) { videoconnection.videoorientation = avcapturevideoorientation.portrait stillimageoutput?.capturestillimageasynchronouslyfromconnection(videoconnection, completionhandler: {(samplebuffer, error) in if (samplebuffer != nil) { var imagedata = avcapturestillimageoutput.jpegstillimagensdatarepresentation(samplebuffer) var dataprovider = cgdataprovidercreatewithcfdata(imagedata) var cgimageref = cgimagecreatewithjpegdataprovider(dataprovider, nil, true, kcgrenderingintentdefault) //change orientation based on if camera front or if self.selectedcamera == 1 { var image = uiimage(cgimage: cgimageref, scale: 1.0, orientation: uiimageorientation.leftmirrored) self.capturedimage.image = image } else { var image = uiimage(cgimage: cgimageref, scale: 1.0, orientation:uiimageorientation.right) self.capturedimage.image = image }
Comments
Post a Comment