https://kotlinlang.org logo
#android
Title
# android
c

Cédric

11/10/2023, 3:51 PM
Hello everyone. I am working on creating a pdf file from images. When I am trying to convert an ImageBitmap to Bitmap like this:
Copy code
imageBitmap.asAndroidBitmap()
, the resulting bitmap gets bigger in size. Can anyone explain to me this behavior and how to avoid that ?
not kotlin but kotlin colored 4
c

Chrimaeon

11/10/2023, 4:04 PM
Size in sense of dimension or bytes?
c

Cédric

11/10/2023, 4:26 PM
Size in sense of bytes.
c

Chrimaeon

11/10/2023, 4:27 PM
Then I guess the
imageBitmap
it still the compressed bitmap as an i.e. png and the android bitmap it the raw bitmap data.
l

Landry Norris

11/10/2023, 4:55 PM
Oddly, the source for asAndroidBitmap (AndroidImageBitmap.android.kt) shows that it just returns the bitmap field of the AndroidImageBitmap, which shouldn't allocate anything or change any size.
c

Cédric

11/10/2023, 5:02 PM
Okay. So my by default compress the image when I take a picture. And now when I'm trying to convert it to
Bitmap
, I get the raw bitmap data, right?