How can I capture a Surface as a png or jpeg file ...
# compose
m
How can I capture a Surface as a png or jpeg file in Compose?
r
The easiest way is to use PixelCopy (https://developer.android.com/reference/android/view/PixelCopy) to capture a Bitmap and then use Bitmap.compress() to generate a PNG or JPEG
m
What are the not-easy ways?
l
The skiko targets have ImageComposeScene for this, which is interestingly missing in Android.
m
Is skiko iOS specific?
l
Skiko supports desktop jvm, and (experimental) iOS and macos.
It's basically what every non-android compose uses. From my understanding, Android uses the bitmap/canvas libraries instead.