{"id":17163108,"url":"https://github.com/noppefoxwolf/animatedimage","last_synced_at":"2026-01-03T03:25:08.787Z","repository":{"id":208929638,"uuid":"721856248","full_name":"noppefoxwolf/AnimatedImage","owner":"noppefoxwolf","description":"High-performance animation image library.","archived":false,"fork":false,"pushed_at":"2024-12-05T18:06:11.000Z","size":6663,"stargazers_count":72,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T23:07:17.837Z","etag":null,"topics":["apng","gif","ios","swift","swiftui","webp"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/noppefoxwolf.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}},"created_at":"2023-11-21T23:06:16.000Z","updated_at":"2025-03-10T02:05:10.000Z","dependencies_parsed_at":"2024-12-03T17:36:26.878Z","dependency_job_id":"642bbe2e-59fe-47f0-9257-8c9c88c2f237","html_url":"https://github.com/noppefoxwolf/AnimatedImage","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"77b14b0b9ef6c5c5c8f4b24e80aa5601b18d1f31"},"previous_names":["noppefoxwolf/animatedimage"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noppefoxwolf%2FAnimatedImage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noppefoxwolf%2FAnimatedImage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noppefoxwolf%2FAnimatedImage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noppefoxwolf%2FAnimatedImage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noppefoxwolf","download_url":"https://codeload.github.com/noppefoxwolf/AnimatedImage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675434,"owners_count":21143763,"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":["apng","gif","ios","swift","swiftui","webp"],"created_at":"2024-10-14T22:47:48.013Z","updated_at":"2026-01-03T03:25:08.767Z","avatar_url":"https://github.com/noppefoxwolf.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AnimatedImage\n\n[![Swift Package Manager Test](https://github.com/noppefoxwolf/AnimatedImage/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/noppefoxwolf/AnimatedImage/actions/workflows/test.yml)\n\nHigh-performance animation image library for Swift.\n\n![](https://github.com/noppefoxwolf/AnimatedImage/blob/main/.github/Format.gif)\n\n## Overview\n\n`AnimatedImage` provides a fast, memory-aware pipeline to render animated images (APNG, GIF, WebP) on Apple platforms. The public `AnimatedImage` module re-exports platform and SwiftUI layers so you can `import AnimatedImage` and use it from UIKit and SwiftUI. Heavy processing is kept off the main thread.\n\n## Installation\n\n### Swift Package Manager\n\n```swift\nlet package = Package(\n    dependencies: [\n        .package(url: \"https://github.com/noppefoxwolf/AnimatedImage\", from: \"0.0.14\")\n    ],\n    targets: [\n        .target(\n            name: \"YourTarget\",\n            dependencies: [\n                .product(name: \"AnimatedImage\", package: \"AnimatedImage\")\n            ]\n        )\n    ]\n)\n```\n\n## How It Works\n\nAnimatedImage uses `AnimatedImageProvider` to pre-decode and cache animation frames for optimal performance. It dynamically optimizes frame processing based on drawing size and timing to prevent excessive cache usage. The entire processing pipeline is designed to operate independently of MainActor, ensuring smooth UI performance.\n\n## Usage\n\n### UIKit\n\n```swift\nimport AnimatedImage\n\nlet imageView = AnimatedImageView(frame: .zero)\nlet image = APNGImage(data: data) // or GifImage(data: data), WebPImage(data: data)\nimageView.image = image\nimageView.startAnimating()\n```\n\n### SwiftUI\n\n```swift\nimport AnimatedImage\n\nstruct ContentView: View {\n    @State var image = GifImage(data: data)\n\n    var body: some View {\n        AnimatedImagePlayer(image: image) // .init(image:contentMode:) supports .fit/.fill\n    }\n}\n```\n\n### Configuration\n\nControl memory, size, quality, and processing priority using `AnimatedImageProviderConfiguration`.\n\n- UIKit\n  ```swift\n  let imageView = AnimatedImageView(frame: .zero)\n  imageView.configuration = .default // .default, .performance, .unlimited\n  imageView.contentMode = .scaleAspectFill\n  imageView.image = GifImage(data: data)\n  imageView.startAnimating()\n  ```\n\n- SwiftUI\n  ```swift\n  let config: AnimatedImageProviderConfiguration = .default\n\n  var body: some View {\n      AnimatedImagePlayer(image: GifImage(data: data))\n          .environment(\\.animatedImageProviderConfiguration, config)\n  }\n  ```\n\n## Features\n\n### Low MainActor Usage\n\n![](https://github.com/noppefoxwolf/AnimatedImage/blob/main/.github/Instruments.png)\n\nAll heavy processing is performed off the main thread, keeping your UI responsive.\n\n### Multiple Format Support\n\n![](https://github.com/noppefoxwolf/AnimatedImage/blob/main/.github/Format.gif)\n\nSupports APNG, GIF, and WebP animated formats.\n\n### Automatic Quality Adjustment\n\n![](https://github.com/noppefoxwolf/AnimatedImage/blob/main/.github/AdjustQuality.gif)\n\nAutomatically adjusts playback quality based on available resources.\n\n### Frame Synchronization\n\n![](https://github.com/noppefoxwolf/AnimatedImage/blob/main/.github/Synchronize.gif)\n\nSynchronizes frame updates for smooth animation playback.\n\n### Custom Animation Support\n\nCreate your own animated images by conforming to the `AnimatedImage` protocol:\n\n```swift\npublic final class ManualAnimatedImage: AnimatedImage, @unchecked Sendable {\n    public let name: String\n    public let imageCount: Int\n    private let images: [CGImage]\n    \n    public init(name: String = UUID().uuidString, images: [CGImage]) {\n        self.name = name\n        self.images = images\n        self.imageCount = images.count\n    }\n    \n    public func delayTime(at index: Int) -\u003e Double {\n        0.1\n    }\n    \n    public func image(at index: Int) -\u003e CGImage? {\n        images[index]\n    }\n}\n```\n\n## Requirements\n\n- Swift 6.2+\n- iOS 16.0+\n- macOS 14.0+\n- visionOS 1.0+\n\n## Architecture\n\nThe library consists of multiple internal modules unified under a single product:\n\n- **`AnimatedImageCore`**: Core animation logic and image processing\n  - Image decoders for APNG, GIF, and WebP\n  - `AnimatedImageProvider` for animation caching and frame management\n  - Image processing and timing calculations\n- **Platform-specific modules**:\n  - `_UIKit_AnimatedImage`: UIKit support with `AnimatedImageView`\n  - `_AppKit_AnimatedImage`: macOS support (in development)\n  - `_SwiftUI_AnimatedImage`: SwiftUI integration with `AnimatedImagePlayer`\n- **`UpdateLink`**: Display link and frame timing control\n\nNotes:\n- `Sources/AnimatedImage/` is the public API that re-exports platform layers and includes `Resources/PrivacyInfo.xcprivacy`.\n- `UpdateLink` uses `UIUpdateLink` on iOS 18+/visionOS 2+ and a `CADisplayLink` backport otherwise.\n\n## Apps Using AnimatedImage\n\n\u003cp float=\"left\"\u003e\n    \u003ca href=\"https://apps.apple.com/app/id1668645019\"\u003e\u003cimg src=\"https://github.com/noppefoxwolf/markdown-resources/blob/main/app-icons/dev.noppe.snowfox.png\" height=\"65\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://apps.apple.com/app/id6470347919\"\u003e\u003cimg src=\"https://github.com/noppefoxwolf/markdown-resources/blob/main/app-icons/lynnpd.threadpd.png\" height=\"65\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://apps.apple.com/app/id6736725704\"\u003e\u003cimg src=\"https://github.com/noppefoxwolf/markdown-resources/blob/main/app-icons/com.nintendo.znsa.png\" height=\"65\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://apps.apple.com/app/id6747976082\"\u003e\u003cimg src=\"https://github.com/noppefoxwolf/markdown-resources/blob/main/app-icons/com.zonepane.zero.png\" height=\"65\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Build \u0026 Test\n\n- Build: `swift build` (use `-c release` for optimized builds)\n- Test: `swift test`\n  - Filter: `swift test --filter ImageProcessorTests`\n- Xcode project (optional): `swift package generate-xcodeproj`\n- Example local demo: open `Playground.swiftpm` in Xcode and run.\n\n## Coding Style\n\n- Indentation: 4 spaces; line length: 100; ordered imports. See `.swift-format`.\n- Format: `swift format --configuration .swift-format --in-place Sources Tests`\n- Naming: Types/protocols UpperCamelCase; methods/vars lowerCamelCase.\n\n## Testing\n\n- Framework: Swift Testing (`import Testing`, `@Suite`, `@Test`).\n- Scope: Focus on core processing (timing, decimation, image ops). Add mocks for images where needed.\n- CI: GitHub Actions runs on macOS 15 with Xcode 16.4; ensure tests pass there.\n\n## License\n\nAnimatedImage is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoppefoxwolf%2Fanimatedimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoppefoxwolf%2Fanimatedimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoppefoxwolf%2Fanimatedimage/lists"}