Im having a really hard time finding any way to crop my captured RAW image before I send it up to the server. Im using NSURLSession and background upload so I need the image to be written to a file.
Im grabbing the RAW image data as NSData using AVCapturePhoto's fileDataRepresentation method. From there I am able to get a CIImage using CIFilter's RAW compatibility but I cant seem to find a way to go back to either NSData or writing the updated image directly to a file. 
Note: 
Unfortunately I cant convert to Jpeg or PNG. My specific application requires that I have as few losses as possible and stick with the RAW data. The resultant file should be convertible to the .dng extension just as the raw result from fileDataRepresentation is.