List of usage examples for android.hardware.camera2 DngCreator writeImage
public void writeImage(@NonNull OutputStream dngOutput, @NonNull Image pixels) throws IOException
From source file:freed.cam.apis.camera2.modules.PictureModuleApi2.java
@NonNull private void process_rawSensor(ImageHolder image, File file) { Log.d(TAG, "Create DNG"); DngCreator dngCreator = new DngCreator(cameraHolder.characteristics, image.getCaptureResult()); //Orientation 90 is not a valid EXIF orientation value, fuck off that is valid! try {//from ww w . ja v a 2s . c o m dngCreator.setOrientation(image.captureResult.get(CaptureResult.JPEG_ORIENTATION)); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } if (appSettingsManager.getApiString(AppSettingsManager.SETTING_LOCATION).equals(KEYS.ON)) dngCreator .setLocation(cameraUiWrapper.getActivityInterface().getLocationHandler().getCurrentLocation()); try { if (!appSettingsManager.GetWriteExternal()) dngCreator.writeImage(new FileOutputStream(file), image.getImage()); else { DocumentFile df = cameraUiWrapper.getActivityInterface().getFreeDcamDocumentFolder(); DocumentFile wr = df.createFile("image/*", file.getName()); dngCreator.writeImage( cameraUiWrapper.getContext().getContentResolver().openOutputStream(wr.getUri()), image.getImage()); } cameraUiWrapper.getActivityInterface().ScanFile(file); } catch (IOException ex) { ex.printStackTrace(); } image.getImage().close(); image = null; }