1

i have an issue here whenever the editor intent is activated, the sdk automatic saves the image to the gallery. And again once after the edit is done within the intent. How do i prevent the automatic saving here?

AdobeImageEditorActivity.class

protected void performSave(Bitmap bitmap, Uri saveUri, CompressFormat outputFormat, int quality, boolean hires, AdobeImageEditorActivity.FinalAction action) {
        logger.info("performSave, uri:%s, quality: %d, action:%s", new Object[]{saveUri, Integer.valueOf(quality), action});
        File destFile;
        if(saveUri != null) {
            destFile = new File(saveUri.getPath());
        } else {
            destFile = this.getDefaultOutputDestination(outputFormat);
        }

        try {
            logger.log("trying to create the new file...");
            if(!destFile.exists() && !destFile.createNewFile()) {
                logger.error("Failed to create the file");
            }
        } catch (IOException var11) {
            var11.printStackTrace();

            try {
                logger.error("using a temporary file!");
                destFile = File.createTempFile("aviary-image-", ".jpeg");
            } catch (IOException var10) {
                var10.printStackTrace();
            }
        }

        LocalDataService service = (LocalDataService)this.getMainController().getService(LocalDataService.class);

        assert service != null;

        service.setDestImageUri(Uri.parse(destFile.getAbsolutePath()));
        AdobeImageEditorActivity.SaveHiResImageTask mSaveTask = new AdobeImageEditorActivity.SaveHiResImageTask(destFile, action, outputFormat, quality, hires);
        mSaveTask.execute(new Bitmap[]{bitmap});
    }

i realized the above code might be actually performing that save, however it is a automatic generated file, is there any ways i can do to prevent the saving occurring?

1 Answers1

0

Automatic saves with the Image Editor

The Creative SDK Image Editor saves the edited image when the user closes the Image Editor. It's not possible to prevent this behavior.

The saved image Uri is passed back to your app's Activity in the onActivityResult() method. For a basic demonstration, see this sample app on GitHub.

Dictating where the edited image is saved

It is possible to dictate where the edited image is saved by using the withOutput() method, passing it a File.

You can see all optional methods on the Creative SDK developer portal's Image Editor guide.

Note that the developer portal currently states that you should pass a Uri to withOutput(), but this is incorrect. You should pass in a File:

    /* 1) Change the argument to your desired location */
    File file = new File(Environment.getExternalStorageDirectory() + File.separator + "test.jpg");
    try {
        file.createNewFile();
    } catch (IOException e) {
        e.printStackTrace();
    }

    Intent imageEditorIntent = new AdobeImageIntent.Builder(this)
            .setData(imageUri)
            .withOutput(file) /* 2) Pass the File here */
            .build();
Ash Ryan Arnwine
  • 1,471
  • 1
  • 11
  • 27