'How to save filters in ImageFilterView
I'm using this code to save an image from ImageFilterView. It works with ImageView.
fun saveImage(image: ImageFilterView, context: Context) {
val thread = Thread(object: Runnable {
override fun run() {
val bitmap = (image.drawable as BitmapDrawable).bitmap
val file = Environment.getExternalStorageDirectory()
val dir = File(file.absolutePath + "/Pics")
dir.mkdirs()
val filename = "${System.currentTimeMillis()}.png"
val outFile = File(dir, filename)
var outStream: FileOutputStream? = null
try {
outStream = FileOutputStream(outFile)
} catch (e: Exception) {
e.printStackTrace()
}
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outStream)
try {
outStream?.flush()
} catch (e: Exception) {
e.printStackTrace()
}
try {
outStream?.close()
} catch (e: Exception) {
e.printStackTrace()
}
}
})
thread.start()
}
It saves without the filters applied (saturation, brightness, warmth, contrast), even though it appears in the app with the filters.
Is there a way to save a version of the photo with the filters applied?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
