使用 PhotoEditor SDK 重新编辑具有相同名称的图像仅返回对原始图像的最新更改

Posted

技术标签:

【中文标题】使用 PhotoEditor SDK 重新编辑具有相同名称的图像仅返回对原始图像的最新更改【英文标题】:Re-editing image with same name return only latest changes over original image using PhotoEditor SDK 【发布时间】:2018-09-24 05:28:37 【问题描述】:

我在我的应用程序中使用照片编辑器 android sdk 来编辑图像。当我使用相同的图像进行不同的编辑操作时,例如应用贴纸、过滤器或其他更改。我使用相同的名称编辑和保存图像,然后再次执行编辑,但第二次尝试保存更改时,它会返回仅包含最新更改的原始图像。

目前我每次编辑都必须提供不同的名称。但这不是永久的解决方案。请帮助。

【问题讨论】:

【参考方案1】:
/**
 * We need to notify the MediaScanner when a new file is created.
 * In this way all the gallery applications will be notified too.
 *
 * @param filepath
 */
private void updateMedia( String filepath ) 
    Log.i( LOG_TAG, "updateMedia: " + filepath );
    MediaScannerConnection.scanFile( getApplicationContext(), new String[]  filepath , null, null );

申请数据:

if (output.exists())
output.delete(); //DELETE existing file
        fileName = "myfile.jpg";
        output = new File(imagesFolder, fileName);

    

【讨论】:

我的图像文件存储在我的应用程序数据中。我认为此方法适用于图库图像。 请查看我对应用数据的回答。 我认为 PhotoEditing SDK 缓存了原始图像,这就是它发生的原因,我必须提供具有新名称的相同图像。 删除最后一张图片,清除缓存,然后用相同的名称保存该图片。

以上是关于使用 PhotoEditor SDK 重新编辑具有相同名称的图像仅返回对原始图像的最新更改的主要内容,如果未能解决你的问题,请参考以下文章