{"id":36416386,"url":"https://github.com/shaksternano/gif.kt","last_synced_at":"2026-03-09T00:10:35.676Z","repository":{"id":248663279,"uuid":"822688421","full_name":"shaksternano/gif.kt","owner":"shaksternano","description":"A Kotlin Multiplatform GIF decoding and encoding library.","archived":false,"fork":false,"pushed_at":"2026-03-08T21:16:29.000Z","size":7561,"stargazers_count":27,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-08T21:25:28.040Z","etag":null,"topics":["gif","hacktoberfest","java","kotlin","kotlin-multiplatform"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaksternano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-01T16:02:04.000Z","updated_at":"2026-03-08T21:16:32.000Z","dependencies_parsed_at":"2024-08-26T08:07:50.313Z","dependency_job_id":"bb09a153-dc8f-4d4f-9818-0a46a015f362","html_url":"https://github.com/shaksternano/gif.kt","commit_stats":null,"previous_names":["shaksternano/gifcodec","shaksternano/gifkt"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/shaksternano/gif.kt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaksternano%2Fgif.kt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaksternano%2Fgif.kt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaksternano%2Fgif.kt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaksternano%2Fgif.kt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaksternano","download_url":"https://codeload.github.com/shaksternano/gif.kt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaksternano%2Fgif.kt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30278153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gif","hacktoberfest","java","kotlin","kotlin-multiplatform"],"created_at":"2026-01-11T16:59:17.522Z","updated_at":"2026-03-09T00:10:35.657Z","avatar_url":"https://github.com/shaksternano.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gif.kt\n\n[![GitHub license](https://img.shields.io/github/license/shaksternano/gif.kt)](LICENSE)\n[![Download](https://img.shields.io/maven-central/v/com.shakster/gifkt)](https://central.sonatype.com/artifact/com.shakster/gifkt)\n[![Kotlin](https://img.shields.io/badge/kotlin-2.3.10-blue.svg?logo=kotlin)](https://kotlinlang.org)\n[![Java](https://img.shields.io/badge/java-8-blue.svg?logo=openjdk)](https://www.java.com)\n[![KDoc link](https://img.shields.io/badge/API_reference-KDoc-blue)](https://gifkt.shakster.com)\n\nA Kotlin Multiplatform GIF decoding and encoding library.\n\n## Features\n\n- Supports static and animated GIFs.\n- Easy to use API.\n- Memory-efficient decoding.\n- Fast parallel encoding.\n- Automatic lossless compression when encoding, as well as optional lossy compression.\n- Automatic handling of GIF minimum frame duration when encoding.\n- Supports several GIF options, such as looping and comments.\n\n## Installation\n\nRequires JDK 8 or higher when targeting the JVM.\n\n### Gradle\n\n```kotlin\nrepositories {\n    mavenCentral()\n    google()\n}\n\ndependencies {\n    implementation(\"com.shakster:gifkt:0.3.3\")\n}\n```\n\n### Maven\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003egoogle\u003c/id\u003e\n        \u003curl\u003ehttps://maven.google.com\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.shakster\u003c/groupId\u003e\n        \u003cartifactId\u003egifkt-jvm\u003c/artifactId\u003e\n        \u003cversion\u003e0.3.3\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## Usage\n\nAPI documentation is available [here](https://gifkt.shakster.com).\n\n### Decoding\n\n#### Kotlin\n\n```kotlin\n// Obtain a Path to read the GIF data from\nval path: Path = ...\nval data = path.asRandomAccess()\nval decoder = GifDecoder(data)\n\n// Read a single frame by index\nval frame1 = decoder[0]\n\n// Read a single frame by timestamp\nval frame2 = decoder[2.seconds]\n\n// Read all frames\ndecoder.asSequence().forEach { frame -\u003e\n    // Process each frame\n}\n\ndecoder.close()\n```\n\n#### Java\n\n```java\n// Obtain a Path to read the GIF data from\nPath path = ...;\nRandomAccessData data = RandomAccessData.of(path);\nGifDecoder decoder = new GifDecoder(data);\n\n// Read a single frame by index\nImageFrame frame1 = decoder.get(0);\n\n// Read a single frame by timestamp\nImageFrame frame2 = decoder.get(Duration.ofSeconds(2));\n\n// Read all frames\nfor (ImageFrame frame : decoder.asList()) {\n    // Process each frame\n}\n\ndecoder.close();\n```\n\n### Encoding\n\n#### Kotlin\n\n```kotlin\n// Obtain a Path to write the GIF data to\nval path: Path = ...\nval sink = SystemFileSystem.sink(path).buffered()\nval encoder = GifEncoder(sink)\n\nval argb: IntArray = ...\nval width: Int = ...\nval height: Int = ...\nval duration: Duration = ...\nencoder.writeFrame(argb, width, height, duration)\n\nencoder.close()\n```\n\n#### Java\n\n```java\n// Obtain a Path to write the GIF data to\nPath path = ...;\nOutputStream outputStream = Files.newOutputStream(path);\nGifEncoderBuilder builder = GifEncoder.builder(outputStream);\nGifEncoder encoder = builder.build();\n\nint[] argb = ...;\nint width = ...;\nint height = ...;\nDuration duration = ...;\nencoder.writeFrame(argb, width, height, duration);\n\nencoder.close();\n```\n\n### Parallel Encoding\n\nNot supported on JavaScript or Wasm.\n\n#### Kotlin\n\n```kotlin\n// Obtain a Path to write the GIF data to\nval path: Path = ...\nval sink = SystemFileSystem.sink(path).buffered()\n// Use all available CPU cores for maximum encoding speed\nval cpuCount: Int = ...\nval encoder = ParallelGifEncoder(\n    sink,\n    maxConcurrency = cpuCount,\n    ioContext = Dispatchers.IO,\n)\n\nval argb1: IntArray = ...\nval width1: Int = ...\nval height1: Int = ...\nval duration1: Duration = ...\n\nval argb2: IntArray = ...\nval width2: Int = ...\nval height2: Int = ...\nval duration2: Duration = ...\n\n// Frames are encoded in parallel\n// Suspending\nencoder.writeFrame(argb1, width1, height1, duration1)\nencoder.writeFrame(argb2, width2, height2, duration2)\n\n// Suspending\nencoder.close()\n```\n\n#### Java\n\n```java\n// Obtain a Path to write the GIF data to\nPath path = ...;\nOutputStream outputStream = Files.newOutputStream(path);\n// Use all available CPU cores for maximum encoding speed\nint cpuCount = ...;\nGifEncoderBuilder builder = GifEncoder.builder(outputStream);\nbuilder.setMaxConcurrency(cpuCount);\nbuilder.setIoContext(Dispatchers.getIO());\nParallelGifEncoder encoder = builder.buildParallel();\n\nint[] argb1 = ...;\nint width1 = ...;\nint height1 = ...;\nDuration duration1 = ...;\n\nint[] argb2 = ...;\nint width2 = ...;\nint height2 = ...;\nDuration duration2 = ...;\n\n// Frames are encoded in parallel\nencoder.writeFrameFuture(argb1, width1, height1, duration1)\n    .thenCompose(unused -\u003e encoder.writeFrameFuture(argb2, width2, height2, duration2))\n    .thenCompose(unused -\u003e encoder.closeFuture())\n    .join();\n```\n\n## Modules\n\n### Core\n\nThe [core](core) module contains the main library code.\n\n### Compose\n\nThe [compose](compose) module contains [Compose Multiplatform](https://www.jetbrains.com/compose-multiplatform) integration.\n\nRequires JDK 11 or higher when targeting the JVM.\n\n#### Gradle\n\n```kotlin\ndependencies {\n    implementation(\"com.shakster:gifkt-compose:0.3.3\")\n}\n```\n\n### CLI\n\nThe [cli](cli) module contains a command-line interface GIF encoder tool that uses the library to create GIFs from\nimages, videos, and other GIFs.\n\nRequires JDK 21 or higher to run.\n\n## Developing\n\nJDK 21 or higher is required to build the project.\n\nRun `./gradlew build` to build the project.\n\nRun `./gradlew cleanAllTests allTests` to run all tests.\n\nRun `./gradlew dokkaGenerate` to generate API documentation. The output will be in `core/build/dokka/html`.\n\n## Snapshot Releases\n\nA snapshot release is published with every push to the main branch.\nTo use a snapshot release, add the Maven snapshot repository and append `-SNAPSHOT` to the version.\n\n### Gradle\n\n```kotlin\nrepositories {\n    mavenCentral()\n    google()\n    maven(\"https://central.sonatype.com/repository/maven-snapshots\")\n}\n\ndependencies {\n    implementation(\"com.shakster:gifkt:0.3.3-SNAPSHOT\")\n}\n```\n\n### Maven\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003egoogle\u003c/id\u003e\n        \u003curl\u003ehttps://maven.google.com\u003c/url\u003e\n    \u003c/repository\u003e\n    \u003crepository\u003e\n        \u003cid\u003emaven-snapshots\u003c/id\u003e\n        \u003curl\u003ehttps://central.sonatype.com/repository/maven-snapshots\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.shakster\u003c/groupId\u003e\n        \u003cartifactId\u003egifkt-jvm\u003c/artifactId\u003e\n        \u003cversion\u003e0.3.3-SNAPSHOT\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaksternano%2Fgif.kt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaksternano%2Fgif.kt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaksternano%2Fgif.kt/lists"}