ios - AVFoundation saving Photo in-app is 3-4 times larger than saving using the Photos app -


i using avfoundation capture photos , save photos locally.

i data using avcapturephotooutput.jpegphotodatarepresentation, file size seems 3-4x compared size when saving using photos framework. how can be?

photodata:

photodata = avcapturephotooutput.jpegphotodatarepresentation(forjpegsamplebuffer: photosamplebuffer, previewphotosamplebuffer: previewphotosamplebuffer) 

code saving using photos framework:

phphotolibrary.shared().performchanges({ [unowned self] in     let creationrequest = phassetchangerequest.creationrequestforasset(from: uiimage(data: photodata)!)     creationrequest.creationdate = date()      if let assetcollection = assetcollection, let assetplaceholder = creationrequest.placeholderforcreatedasset {         let albumchangerequest = phassetcollectionchangerequest(for: assetcollection)         let enumeration: nsarray = [assetplaceholder]          albumchangerequest?.addassets(enumeration)     }      }, completionhandler: { [unowned self] success, error in     } ) 

code saving locally:

try! photodata.write(to: originalfilepath, options: .atomic) 

photodata data.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -