Skip to content

Commit daecc1d

Browse files
authored
Merge pull request fluttercandies#161 from digitalrmdy/master
keepExif fix
2 parents 3c9add9 + 1baf352 commit daecc1d

File tree

1 file changed

+4
-4
lines changed
  • android/src/main/kotlin/com/example/flutterimagecompress/handle/common

1 file changed

+4
-4
lines changed

android/src/main/kotlin/com/example/flutterimagecompress/handle/common/CommonHandler.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class CommonHandler(override val type: Int) : FormatHandler {
3636
val result = compress(byteArray, minWidth, minHeight, quality, rotate, inSampleSize)
3737

3838
if (keepExif && bitmapFormat == Bitmap.CompressFormat.JPEG) {
39-
val keeper = ExifKeeper(result)
40-
val tmpStream = ByteArrayOutputStream().apply { write(result) }
41-
val resultStream = keeper.writeToOutputStream(
39+
val byteArrayOutputStream = ByteArrayOutputStream()
40+
byteArrayOutputStream.write(result)
41+
val resultStream = ExifKeeper(byteArray).writeToOutputStream(
4242
context,
43-
tmpStream
43+
byteArrayOutputStream
4444
)
4545
outputStream.write(resultStream.toByteArray())
4646
} else {

0 commit comments

Comments
 (0)