compose-capture-to-share-image

Installation
SKILL.md

Capturing a composable to a shareable image

Three pieces, each an expect/actual pair except the capture itself:

  1. A capturable() modifier plus CaptureController — common code, no platform split — that records a composable's own draw pass into a GraphicsLayer and hands it back as an ImageBitmap on demand.
  2. ImageBitmap.toPngByteArray() — PNG, not whatever format the app's existing bitmap-to-bytes function already produces.
  3. saveImageToDevice() / shareImage() — MediaStore plus a share sheet on Android, a downloads write plus "reveal in the file manager" on Desktop.
fun Modifier.capturable(controller: CaptureController): Modifier = this then CapturableModifierNodeElement(controller)
Installs
2
GitHub Stars
35
First Seen
6 days ago
compose-capture-to-share-image — maxrave-dev/kotlin-footguns