{"id":13659571,"url":"https://github.com/panpf/zoomimage","last_synced_at":"2025-05-16T04:05:14.240Z","repository":{"id":171285225,"uuid":"647222866","full_name":"panpf/zoomimage","owner":"panpf","description":"ZoomImage is an gesture zoom viewing of images library specially designed for Compose Multiplatform and Android View. Supported scale, pan, locate, rotation, and super-large image subsampling.","archived":false,"fork":false,"pushed_at":"2025-05-09T08:22:29.000Z","size":89637,"stargazers_count":440,"open_issues_count":5,"forks_count":21,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-09T09:29:41.789Z","etag":null,"topics":["android","compose","compose-multiplatform","huge","image","locate","multiplatform","pan","positioning","rotate","rotation","scale","scaling","subsampling","super-large","translation","view","zoom"],"latest_commit_sha":null,"homepage":"https://panpf.github.io/zoomimage/","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/panpf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2023-05-30T10:16:02.000Z","updated_at":"2025-05-09T02:23:16.000Z","dependencies_parsed_at":"2024-07-23T12:31:44.883Z","dependency_job_id":"db1cebad-e5d1-4818-af97-551b2fcff7ed","html_url":"https://github.com/panpf/zoomimage","commit_stats":{"total_commits":1070,"total_committers":2,"mean_commits":535.0,"dds":0.002803738317757043,"last_synced_commit":"76d7d26efcd1fac40e1ce35c8fb457396deb1da7"},"previous_names":["panpf/zoomimage"],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panpf%2Fzoomimage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panpf%2Fzoomimage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panpf%2Fzoomimage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panpf%2Fzoomimage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panpf","download_url":"https://codeload.github.com/panpf/zoomimage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464895,"owners_count":22075570,"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","compose","compose-multiplatform","huge","image","locate","multiplatform","pan","positioning","rotate","rotation","scale","scaling","subsampling","super-large","translation","view","zoom"],"created_at":"2024-08-02T05:01:10.184Z","updated_at":"2025-05-16T04:05:09.230Z","avatar_url":"https://github.com/panpf.png","language":"Kotlin","readme":"# ![logo_image] ZoomImage\n\n![Platform][platform_image]\n![Platform2][platform_image2]\n[![API][min_api_image]][min_api_link]\n[![License][license_image]][license_link]\n[![version_icon]][version_link]\n\nTranslations: [简体中文](README.zh.md)\n\nZoomImage is an gesture zoom viewing of images library specially designed for Compose Multiplatform\nand Android View. It has the following features and functions:\n\n* `Compose Multiplatform`. Support for Compose Multiplatform, which can be used on Android, macOS,\n  Windows, Linux and other platforms\n* `Power`. Supports basic functions such as double-click scale, two-finger scale, single-finger\n  scale, mouse wheel scale, keyboard scale, single-finger drag, inertial sliding, and keyboard drag.\n* `Locate`. Support for locate anywhere in the image and keeping it in the center of the screen\n* `Rotate`. Supports 0°, 90°, 180°, 270°, 360° rotation of pictures\n* `Subsampling`. Support for subsampling of very large images to avoid OOM, tile support animation,\n  and sharpness gradients\n* `Dynamic scale factor`. Automatically calculates the most appropriate double-click scaling factor\n  based on image size and container size\n* `Scaling damping`. When manually scaled beyond the maximum or minimum scale factor, there is a\n  damped rubber band effect\n* `Scroll bar`. Supports displaying horizontal and vertical scroll bars to clarify the current\n  scroll position\n* `Read Mode`. When a long image is displayed in reading mode, the initial state automatically fills\n  the screen, and the user can immediately start reading the image content, eliminating the need for\n  the user to double-click to scale in\n* `Exif`. Support reading Exif Orientation information and automatically rotating images\n* `Image Loader`. Provide support for image loaders such as sketch, coil, glide, picasso, etc., and\n  can also customize support for more image loaders\n\nhttps://github.com/panpf/zoomimage/assets/3250512/f067bed9-24e4-4ab8-a839-0731e155f4ef\n\n## Multiplatform support\n\n| Function/Platform    | Android | iOS | Desktop | Web |\n|:---------------------|:-------:|:---:|:-------:|:---:|\n| Zoom                 |    ✅    |  ✅  |    ✅    |  ✅  |\n| Subsampling          |    ✅    |  ✅  |    ✅    |  ✅  |\n| Exif Orientation     |    ✅    |  ✅  |    ✅    |  ✅  |\n| Integrated [Sketch]  |    ✅    |  ✅  |    ✅    |  ✅  |\n| Integrated [Coil]    |    ✅    |  ✅  |    ✅    |  ✅  |\n| Integrated [Glide]   |    ✅    |  ❌  |    ❌    |  ❌  |\n| Integrated [Picasso] |    ✅    |  ❌  |    ❌    |  ❌  |\n\n## Sample App\n\n* For Android, iOS, desktop version, and web deployable packages, please go to\n  the [Releases](https://github.com/panpf/zoomimage/releases) page to download.\n* Web example：https://panpf.github.io/zoomimage/app\n\n## Download\n\n`Published to mavenCentral`\n\n`${LAST_VERSION}`: [![Download][version_icon]][version_link] (Not included 'v')\n\nCompose multiplatform:\n\n```kotlin\n// Provides the SketchZoomAsyncImage component adapted to the Sketch v4+ image loader (recommended)\nimplementation(\"io.github.panpf.zoomimage:zoomimage-compose-sketch4:${LAST_VERSION}\")\n\n// Provides SketchZoomAsyncImage component adapted to the old Sketch v3 image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-compose-sketch3:${LAST_VERSION}\")\n\n// Provides the CoilZoomAsyncImage component adapted to the Coil v3+ image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-compose-coil3:${LAST_VERSION}\")\n\n// Provides CoilZoomAsyncImage component adapted to the old Coil v2 image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-compose-coil2:${LAST_VERSION}\")\n\n// Provides basic ZoomImage component, additional work needs to be done to support subsampling, and does not support network images.\nimplementation(\"io.github.panpf.zoomimage:zoomimage-compose:${LAST_VERSION}\")\n\n// Support loading images from composeResources folder\nimplementation(\"io.github.panpf.zoomimage:zoomimage-compose-resources:${LAST_VERSION}\")\n```\n\n\u003e [!TIP]\n\u003e Just choose one according to the image loader you use or your needs.\n\nOnly android compose:\n\n```kotlin\n// Provides the GlideZoomAsyncImage component adapted to the Glide image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-compose-glide:${LAST_VERSION}\")\n```\n\n\u003e [!TIP]\n\u003e Why is there no picasso version of the compose ZoomImage component? Because Picasso has officially\n\u003e stated that it will not provide support for compose ([Original post here][picasso_compose_post])\n\nAndroid view:\n\n```kotlin\n// Provides the SketchZoomImageView component adapted to the Sketch v4+ image loader (recommended)\nimplementation(\"io.github.panpf.zoomimage:zoomimage-view-sketch4:${LAST_VERSION}\")\n\n// Provides SketchZoomImageView component adapted to the old Sketch v3 image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-view-sketch3:${LAST_VERSION}\")\n\n// Provides the CoilZoomImageView component adapted to the Coil v3+ image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-view-coil3:${LAST_VERSION}\")\n\n// Provides CoilZoomImageView component adapted to the old Coil v2 image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-view-coil2:${LAST_VERSION}\")\n\n// Provides the GlideZoomImageView component adapted to the Glide image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-view-glide:${LAST_VERSION}\")\n\n// Provides the PicassoZoomImageView component adapted to the Picasso image loader\nimplementation(\"io.github.panpf.zoomimage:zoomimage-view-picasso:${LAST_VERSION}\")\n\n// Provides the most basic ZoomImageView component. Additional work needs to be done to support subsampling. Network images are not supported.\nimplementation(\"io.github.panpf.zoomimage:zoomimage-view:${LAST_VERSION}\")\n```\n\n\u003e [!TIP]\n\u003e Just choose one according to the image loader you use or your needs.\n\n### R8 / Proguard\n\nZoomImage's own obfuscation is already included in aar, but you may also need to add obfuscation\nconfiguration for other libraries that depend indirectly\n\n## Quickly Started\n\nCompose multiplatform:\n\n```kotlin\n// Use basic ZoomImage components\nval zoomState: ZoomState by rememberZoomState()\nLaunchedEffect(zoomState.subsampling) {\n    val resUri = Res.getUri(\"files/huge_world.jpeg\")\n    val imageSource = ImageSource.fromComposeResource(resUri)\n    zoomState.setSubsamplingImage(imageSource)\n}\nZoomImage(\n    painter = painterResource(Res.drawable.huge_world_thumbnail),\n    contentDescription = \"view image\",\n    modifier = Modifier.fillMaxSize(),\n    zoomState = zoomState,\n)\n\n// Use SketchZoomAsyncImage component\nSketchZoomAsyncImage(\n    uri = \"https://sample.com/sample.jpeg\",\n    contentDescription = \"view image\",\n    modifier = Modifier.fillMaxSize(),\n)\n\n// Use CoilZoomAsyncImage component\nCoilZoomAsyncImage(\n    model = \"https://sample.com/sample.jpeg\",\n    contentDescription = \"view image\",\n    modifier = Modifier.fillMaxSize(),\n)\n```\n\n\u003e [!TIP]\n\u003e The usage of SketchZoomAsyncImage and CoilZoomAsyncImage is the same as their original AsyncImage,\n\u003e except that there is an additional `zoomState: ZoomState` parameter\n\nOnly android compose:\n\n```kotlin\n// Use GlideZoomAsyncImage component\nGlideZoomAsyncImage(\n    model = \"https://sample.com/sample.jpeg\",\n    contentDescription = \"view image\",\n    modifier = Modifier.fillMaxSize(),\n)\n```\n\n\u003e [!TIP]\n\u003e The usage of GlideZoomAsyncImage is the same as its original GlideImage, except that there is an\n\u003e additional `zoomState: ZoomState` parameter\n\nAndroid view:\n\n```kotlin\n// Use basis ZoomImageView component\nval zoomImageView = ZoomImageView(context)\nzoomImageView.setImageResource(R.drawable.huge_world_thumbnail)\nzoomImageView.setSubsamplingImage(ImageSource.fromResource(R.raw.huge_world))\n\n// Use SketchZoomAsyncImage component\nval sketchZoomImageView = SketchZoomImageView(context)\nsketchZoomImageView.loadImage(\"https://sample.com/sample.jpeg\")\n\n// Use CoilZoomImageView component\nval coilZoomImageView = CoilZoomImageView(context)\nsketchZoomImageView.loadImage(\"https://sample.com/sample.jpeg\")\n\n// Use GlideZoomImageView component\nval glideZoomImageView = GlideZoomImageView(context)\nGlide.with(this@GlideZoomImageViewFragment)\n    .load(\"https://sample.com/sample.jpeg\")\n    .into(glideZoomImageView)\n\n// Use PicassoZoomImageView component\nval picassoZoomImageView = PicassoZoomImageView(context)\npicassoZoomImageView.loadImage(\"https://sample.com/sample.jpeg\")\n```\n\n## Document\n\n* [Get Started](docs/getting_started.md)\n* [Scale: Scale the image to see clearer details](docs/scale.md)\n* [Offset: Move the image to see content outside the container](docs/offset.md)\n* [Rotate: Rotate the image to view content from different angles](docs/rotate.md)\n* [Locate: Locate anywhere in the image](docs/locate.md)\n* [Read Mode: Long images initially fill the screen for easy reading](docs/readmode.md)\n* [Click: Receive click events](docs/click.md)\n* [Subsampling: Display large images through subsampling to avoid OOM](docs/subsampling.md)\n* [Scroll Bar: Displays horizontal and vertical scroll bars](docs/scrollbar.md)\n* [Log: Modify log level and output pipeline](docs/log.md)\n* [Modifier.zoom()](docs/modifier_zoom.md)\n\n## Samples\n\nYou can find the sample code in\nthe [examples](sample/src/commonMain/kotlin/com/github/panpf/zoomimage/sample/ui/examples)\ndirectory, or you can go to [release](https://github.com/panpf/zoomimage/releases) page download\nApp experience\n\n## Change Log\n\nPlease review the [CHANGELOG](CHANGELOG.md) file\n\n## Test Platform\n\n* Android: Emulator; Arm64; API 21-34\n* Desktop: macOS; 14.6.1; JDK 17\n* iOS: iphone 16 simulator; iOS 18.1\n* Web: Chrome; 130\n\n## Run Sample App\n\nPrepare the environment:\n\n1. Android Studio: Koala+ (2024.1.1+)\n2. JDK: 17+\n3. Use [kdoctor] to check the running environment and follow the prompts to install the required\n   software\n4. Android Studio installs the `Kotlin Multiplatform` and `Compose Multiplatform IDE Support`plugins\n\nRun the sample app:\n\n1. Clone the project and open it using Android Studio\n2. The running configurations of each platform have been added to the `.run` directory. After\n   synchronization is completed, directly select the running configuration of the corresponding\n   platform in the running configuration drop-down box at the top of Android Studio and click Run.\n3. The running configuration of the ios platform requires you to manually create it according to the\n   template, as follows:\n    1. Copy the `.run/iosSample.run.template.xml` file and remove the `.template` suffix.\n       The `.ignore` file has been configured to ignore `iosSample.run.xml`\n    2. Click `Edit Configurations` in the run configuration drop-down box at the top,\n       select `iosSample` and then configure `Execute target`\n\n## My Projects\n\nThe following are my other open source projects. If you are interested, you can learn about them:\n\n* [sketch](https://github.com/panpf/sketch): Sketch is an image loading library designed for Compose\n  Multiplatform and Android View. It is powerful and rich in functions. In addition to basic\n  functions, it also supports GIF, SVG, video thumbnails, Exif Orientation, etc.\n* [assembly-adapter](https://github.com/panpf/assembly-adapter): A library on Android that provides\n  multi-type Item implementations for various adapters. Incidentally, it also provides the most\n  powerful divider for RecyclerView.\n* [sticky-item-decoration](https://github.com/panpf/stickyitemdecoration): RecyclerView sticky item\n  implementation\n\n## License\n\nApache 2.0. See the [LICENSE](LICENSE.txt) file for details.\n\n[logo_image]: docs/images/logo_mini.png\n\n[platform_image]: https://img.shields.io/badge/Platform-Android-brightgreen.svg\n\n[platform_image2]: https://img.shields.io/badge/Platform-ComposeMultiplatform-brightblue.svg\n\n[license_image]: https://img.shields.io/badge/License-Apache%202-blue.svg\n\n[license_link]: https://www.apache.org/licenses/LICENSE-2.0\n\n[version_icon]: https://img.shields.io/maven-central/v/io.github.panpf.zoomimage/zoomimage-compose\n\n[version_link]: https://repo1.maven.org/maven2/io/github/panpf/zoomimage/\n\n[min_api_image]: https://img.shields.io/badge/AndroidAPI-21%2B-orange.svg\n\n[min_api_link]: https://android-arsenal.com/api?level=21\n\n[Sketch]: https://github.com/panpf/sketch\n\n[Coil]: https://github.com/coil-kt/coil\n\n[Glide]: https://github.com/bumptech/glide\n\n[Picasso]: https://github.com/square/picasso\n\n[picasso_compose_post]: https://github.com/square/picasso/issues/2203#issuecomment-826444442\n\n[kdoctor]: https://github.com/Kotlin/kdoctor","funding_links":[],"categories":["Libraries","Uncategorized","Multiplatform","Kotlin"],"sub_categories":["🍎 Compose UI","Uncategorized","Android samples"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanpf%2Fzoomimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanpf%2Fzoomimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanpf%2Fzoomimage/lists"}