Android 检索“;“干净”;图像视图外的图像
我已经将图像存储在ImageView中,经过几个过程(翻转、旋转、固定颜色等)后,它会保存回新文件。然而,我才意识到,当我只是加载到ImageView中,然后直接保存结果时,我得到了不同的结果。请看附件中的图片以供参考 图像源 图像结果 以下是我如何从ImageView中提取图像:Android 检索“;“干净”;图像视图外的图像,android,bitmap,imageview,Android,Bitmap,Imageview,我已经将图像存储在ImageView中,经过几个过程(翻转、旋转、固定颜色等)后,它会保存回新文件。然而,我才意识到,当我只是加载到ImageView中,然后直接保存结果时,我得到了不同的结果。请看附件中的图片以供参考 图像源 图像结果 以下是我如何从ImageView中提取图像: String filePath = Environment.getExternalStorageDirectory() + File.separator + bufferPath; ByteArrayOutput
String filePath = Environment.getExternalStorageDirectory()
+ File.separator + bufferPath;
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
selectedImage.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(selectedImage.getDrawingCache());
selectedImage.setDrawingCacheEnabled(false);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
imageFile = new File( filePath );
//write the bytes in file
FileOutputStream fo = new FileOutputStream(imageFile);
fo.write(bytes.toByteArray());
是否有任何解决方法使生成的图像与源图像相同?可能是不同的组件?持有一个备份
位图(最初是源代码),您可以对其执行操作
使用ImageView
仅显示此位图
-不要操作ImageView
的绘图缓存中保存的后缩放版本。哈哈哈,你说得对,我应该只使用ImageView作为显示。