{"id":13610673,"url":"https://github.com/mahozad/comshot","last_synced_at":"2025-10-29T05:32:08.643Z","repository":{"id":222159097,"uuid":"755456002","full_name":"mahozad/comshot","owner":"mahozad","description":"Capture screenshot of Composables and Views (multiplatform)","archived":false,"fork":false,"pushed_at":"2024-09-02T10:17:59.000Z","size":403,"stargazers_count":35,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-07T17:44:42.582Z","etag":null,"topics":["android","capture-screenshots","compose-multiplatform","jetpack","jetpack-compose","kotlin","kotlin-multiplatform","kotlin-multiplatform-library","kotlin-multiplatform-sample","screenshot","screenshot-utility"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mahozad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-10T09:04:34.000Z","updated_at":"2024-09-02T16:09:04.000Z","dependencies_parsed_at":"2024-07-18T09:39:23.220Z","dependency_job_id":null,"html_url":"https://github.com/mahozad/comshot","commit_stats":null,"previous_names":["mahozad/comshot"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahozad%2Fcomshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahozad%2Fcomshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahozad%2Fcomshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahozad%2Fcomshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahozad","download_url":"https://codeload.github.com/mahozad/comshot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238777982,"owners_count":19528818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","capture-screenshots","compose-multiplatform","jetpack","jetpack-compose","kotlin","kotlin-multiplatform","kotlin-multiplatform-library","kotlin-multiplatform-sample","screenshot","screenshot-utility"],"created_at":"2024-08-01T19:01:46.951Z","updated_at":"2025-10-29T05:32:08.638Z","avatar_url":"https://github.com/mahozad.png","language":"Kotlin","funding_links":[],"categories":["Kotlin","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"[![Kotlin version]][Kotlin release]\n[![Compose Multiplatform version]][Compose Multiplatform release]\n[![Latest Maven Central release]][Library on Maven Central]\n\n\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"asset/logo-optimized.svg\" width=\"100px\"/\u003e\n\u003c/div\u003e\n\n# 🕯️ Library retired\nYou probably no longer need this library (or similar libraries)\nbecause Jetpack Compose and Compose Multiplatform [now support taking screenshots][Added GraphicsLayer.toImageBitmap].\nSee [Jetpack Compose take screenshot of composable function][Take screenshot of Composable function].\n\n# Comshot\nMultiplatform library to take/capture screenshot/snapshot/picture/image of @Composables (and also Android Views).\n\n## Warning\n🚧 This library is experimental and tested only on Windows and Android. \u003cbr/\u003e\n🚧 This library may not be suited for use in production code.\n\n## Usage\n```kotlin\nimplementation(\"ir.mahozad.multiplatform:comshot:0.3.0\")\n```\n\n  - Android (`@Composable`s)  \n    You need to pass your activity to `captureToImage`. Also, it should be called from the Main aka UI thread (see its KDoc for more information).\n    ```kotlin\n    @Composable\n    fun Activity.MyComposable() {\n        val activity = this\n        var screenshot by remember { mutableStateOf\u003cImageBitmap?\u003e(null) }\n        val composable: @Composable () -\u003e Unit = remember {\n            @Composable {\n                Row {\n                    Text(text = \"Hello\")\n                    Text(text = \"Meow!\")\n                }\n            }\n        }\n        // You can also render your composable simply like this:\n        // composable()\n        Column {\n            Button(onClick = { screenshot = captureToImage(activity, composable) }) {\n                Text(text = \"Capture\")\n            }\n            screenshot?.let {\n                Image(\n                    bitmap = it,\n                    modifier = Modifier.width(200.dp),\n                    contentDescription = null\n                )\n            }\n        }\n    }\n    ```\n  - Android (`View`s)\n    ```kotlin\n    val view = findViewById\u003cTextView\u003e(R.id.myTextView)\n    val screenshot = captureToImage(view)\n    // If you want Bitmap:\n    val androidBitmap = screenshot.asAndroidBitmap()\n    ```\n - Other targets\n   ```kotlin\n   @Composable\n   fun MyComposable() {\n       var screenshot by remember { mutableStateOf\u003cImageBitmap?\u003e(null) }\n       val composable: @Composable () -\u003e Unit = remember {\n           @Composable {\n               Row {\n                   Text(text = \"Hello\")\n                   Text(text = \"Meow!\")\n               }\n           }\n       }\n       // You can also render your composable simply like this:\n       // composable()\n       Column {\n           Button(onClick = { screenshot = captureToImage(composable) }) {\n               Text(text = \"Capture\")\n           }\n           screenshot?.let {\n               Image(\n                   bitmap = it,\n                   modifier = Modifier.width(200.dp),\n                   contentDescription = null\n               )\n           }\n       }\n   }\n   ```\n\n## Related\n  - Capturable : https://github.com/PatilShreyas/Capturable\n  - Compose ScreenshotBox: https://github.com/SmartToolFactory/Compose-Screenshot\n  - Generate bitmap from composable: https://github.com/JohannRosenberg/bitmap-from-composable\n  - Generate JPEG from composable: https://github.com/Vipul12Thawre/JetCapture\n  - https://developer.android.com/studio/preview/compose-screenshot-testing\n  - https://developer.android.com/reference/androidx/test/espresso/screenshot/ViewInteractionCapture\n\n[Kotlin version]: https://img.shields.io/badge/Kotlin-2.0.0-303030.svg?labelColor=303030\u0026logo=data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAxOC45MyAxOC45MiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjE4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyYWRpYWxHcmFkaWVudCBpZD0iZ3JhZGllbnQiIHI9IjIxLjY3OSIgY3g9IjIyLjQzMiIgY3k9IjMuNDkzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgLTQuMTMgLTIuNzE4KSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgPHN0b3Agc3RvcC1jb2xvcj0iI2U0NDg1NyIgb2Zmc2V0PSIuMDAzIi8+CiAgICA8c3RvcCBzdG9wLWNvbG9yPSIjYzcxMWUxIiBvZmZzZXQ9Ii40NjkiLz4KICAgIDxzdG9wIHN0b3AtY29sb3I9IiM3ZjUyZmYiIG9mZnNldD0iMSIvPgogIDwvcmFkaWFsR3JhZGllbnQ+CiAgPHBhdGggZmlsbD0idXJsKCNncmFkaWVudCkiIGQ9Ik0gMTguOTMsMTguOTIgSCAwIFYgMCBIIDE4LjkzIEwgOS4yNyw5LjMyIFoiLz4KPC9zdmc+Cg==\n[Compose Multiplatform version]: https://img.shields.io/badge/Compose_Multiplatform-1.6.11-303030.svg?labelColor=303030\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAj5JREFUOI2Vk0FIVFEUhv9znBllplBIF7loK1jtJKhFNG/EVtYicNkmKghCMpJGq0HoPcWQVi2KUMqdixaJi0KdXVBILQojs4wCaTGC4LyX+N47fwtFpnEKOnDh3p//fudeDr+QRK3KukGHCscAwCjXi4PphVo+qQZkhzaa61J6m8RhAfpisS01HQOwZin0F29kftYEdDxCsqnkX6HgIonR+YHM00pjzg26oXRBPrNw30ixgM1dgDMcnFFyyIAphpn7xQI2Tw6XW5LQO0L+isPQKxaa1rNDaJCkf02BHhMpzOfTzxUA1GyCxEcFxjcOIu50/b4kZQnkZQJ9mkwuOV5wqaUdYSIhTwBZFto4AOj2R+S7qEwZMNtU8lcoGAPximZHDegAsCjgw7XP/rJFnDHBhEB+AABIIueW35FEdsQ/67hl5jz/AklUrpxX7nfcMp27wYnKO/rHCAwhANDkffW4DPJhZxtV6lpt/N+qCRCND+3RDHs0AEhUHii6KIxXSZnq9PxJTUhetrQ+VrsH4TlAvlgUfd3zAgMau0aD1uLNhm8WBm0CjBDoiSN8ijReJHBaRAYtTB8pFvaXukaDVgMadwFC6bWIM47n54GWaHYgM5CwunaASwBe1yXQNptPewDgeH7eIs4IpXcXMDeYnl5vzhxTINCUv+B4/vkXtxpWQEwK8Phlf3o15wbdmvLfCFgfh5njc4Pp6e3mVWHqHN44AOidnTC9NVpJRE+BKP0zTNW1HWc8IMxIvfq3OP8GvjkzgYHHZZMAAAAASUVORK5CYII=\n[Latest Maven Central release]: https://img.shields.io/maven-central/v/ir.mahozad.multiplatform/comshot?label=Maven%20Central\u0026labelColor=303030\u0026logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHN0eWxlPi5he2ZpbGw6bm9uZTt9LmJ7Y2xpcC1wYXRoOnVybCgjYSk7fS5je2ZpbGw6I2ZmZjt9PC9zdHlsZT4KICAgIDxjbGlwUGF0aCBpZD0iYSI+CiAgICAgIDxyZWN0IGNsYXNzPSJhIiB4PSIxNC43IiB5PSIxMSIgd2lkdGg9IjE3MSIgaGVpZ2h0PSIxNTEiLz4KICAgIDwvY2xpcFBhdGg+CiAgICA8Y2xpcFBhdGggaWQ9ImNsaXBQYXRoMTMiPgogICAgICA8cmVjdCBjbGFzcz0iYSIgeD0iMTQuNyIgeT0iMTEiIHdpZHRoPSIxNzEiIGhlaWdodD0iMTUxIi8+CiAgICA8L2NsaXBQYXRoPgogIDwvZGVmcz4KICA8cGF0aCBjbGFzcz0iYyIgdHJhbnNmb3JtPSJtYXRyaXgoLjE2NCAwIDAgLjE2NCAtOC4zNyAtMS44MSkiIGQ9Im0xMDAgMTEtNDIuMyAyNC40djQ4LjlsNDIuMyAyNC40IDQyLjMtMjQuNHYtNDguOXptMzAuMiA2Ni4zLTMwLjIgMTcuNC0zMC4yLTE3LjR2LTM0LjlsMzAuMi0xNy40IDMwLjIgMTcuNHoiIGNsaXAtcGF0aD0idXJsKCNjbGlwUGF0aDEzKSIvPgo8L3N2Zz4K\n[Kotlin release]: https://github.com/JetBrains/kotlin/releases/tag/v2.0.0\n[Compose Multiplatform release]: https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.6.11\n[Library on Maven Central]: https://repo1.maven.org/maven2/ir/mahozad/multiplatform/comshot/0.3.0/\n[Added GraphicsLayer.toImageBitmap]: https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0-alpha06:~:text=Added%20GraphicsLayer%23toImageBitmap,onto%20software%20rendering\n[Take screenshot of Composable function]: https://stackoverflow.com/a/79233218/8583692\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahozad%2Fcomshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahozad%2Fcomshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahozad%2Fcomshot/lists"}