{"id":28559003,"url":"https://github.com/sdwebimage/sdwebimagejpegxlcoder","last_synced_at":"2025-06-10T08:35:53.793Z","repository":{"id":224706318,"uuid":"763393955","full_name":"SDWebImage/SDWebImageJPEGXLCoder","owner":"SDWebImage","description":"A SDWebImage coder plugin to support JPEG-XL image","archived":false,"fork":false,"pushed_at":"2025-02-14T19:59:48.000Z","size":322,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-04T21:59:51.110Z","etag":null,"topics":["ios","jpeg","jpeg-xl","macos","sdwebimage","swift-package-manager","tvos","visionos","watchos"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/SDWebImage.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}},"created_at":"2024-02-26T08:01:25.000Z","updated_at":"2025-03-11T01:29:42.000Z","dependencies_parsed_at":"2024-03-06T17:24:35.453Z","dependency_job_id":"51f94e11-085c-4ba1-8dcb-7b230b2c1cdd","html_url":"https://github.com/SDWebImage/SDWebImageJPEGXLCoder","commit_stats":null,"previous_names":["sdwebimage/sdwebimagejpegxlcoder"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageJPEGXLCoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageJPEGXLCoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageJPEGXLCoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageJPEGXLCoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SDWebImage","download_url":"https://codeload.github.com/SDWebImage/SDWebImageJPEGXLCoder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SDWebImage%2FSDWebImageJPEGXLCoder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259039495,"owners_count":22796847,"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":["ios","jpeg","jpeg-xl","macos","sdwebimage","swift-package-manager","tvos","visionos","watchos"],"created_at":"2025-06-10T08:35:53.311Z","updated_at":"2025-06-10T08:35:53.781Z","avatar_url":"https://github.com/SDWebImage.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SDWebImageJPEGXLCoder\n\n[![Version](https://img.shields.io/cocoapods/v/SDWebImageJPEGXLCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageJPEGXLCoder)\n[![License](https://img.shields.io/cocoapods/l/SDWebImageJPEGXLCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageJPEGXLCoder)\n[![Platform](https://img.shields.io/cocoapods/p/SDWebImageJPEGXLCoder.svg?style=flat)](http://cocoapods.org/pods/SDWebImageJPEGXLCoder)\n[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/SDWebImage/SDWebImageJPEGXLCoder)\n\nSDWebImageJPEGXLCoder is a coder plugin for SDWebImage, to supports [JPEG-XL](https://jpeg.org/jpegxl/) format.\n\nSee: [Why JPEG-XL](https://jpegxl.info/why-jxl.html)\n\nThis coder supports the HDR/SDR decoding, as well as JPEG-XL aniamted image.\n\n## Notes\n\n1. This coder supports animation via UIImageView/NSImageView, no SDAnimatedImageView currently (Because the current coder API need codec supports non-sequential frame decoding, but libjxl does not have. Will remove this limit in SDWebImage 6.0)\n2. Apple's ImageIO supports JPEGXL decoding from iOS 17/tvOS 17/watchOS 10/macOS 14 (via: [WWDC2023](https://developer.apple.com/videos/play/wwdc2023/10122/)), so SDWebImage on those platform can also decode JPEGXL images using `SDImageIOCoder` (but no animated JPEG-XL support)\n3. From v0.2.0, this coder support JXL encoding, including HDR, static JXL, animated JXL encoding as well (a huge work...)\n\n## Requirements\n\n+ iOS 9.0\n+ macOS 10.11\n+ tvOS 9.0\n+ watchOS 2.0\n+ visionOS 1.0\n\n## Installation\n\n#### CocoaPods\n\nSDWebImageJPEGXLCoder is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:\n\n```ruby\npod 'SDWebImageJPEGXLCoder'\n```\n\n#### Carthage\n\nSDWebImageJPEGXLCoder is available through [Carthage](https://github.com/Carthage/Carthage).\n\n```\ngithub \"SDWebImage/SDWebImageJPEGXLCoder\"\n```\n\nNote: You must use `carthage build --use-xcframeworks` for integration (because it supports 5 Apple platforms. You can limit platforms you need by using `--platform iOS,visionOS`)\n\n#### Swift Package Manager\n\nSDWebImageJPEGXLCoder is available through [Swift Package Manager](https://swift.org/package-manager).\n\n```swift\nlet package = Package(\n    dependencies: [\n        .package(url: \"https://github.com/SDWebImage/SDWebImageJPEGXLCoder.git\", from: \"0.1.0\")\n    ]\n)\n```\n\n## Usage\n\n### Add Coder\n\nBefore using SDWebImage to load JPEGXL images, you need to register the JPEGXL Coder to your coders manager. This step is recommended to be done after your App launch (like AppDelegate method).\n\n+ Objective-C\n\n```objective-c\n// Add coder\nSDImageJPEGXLCoder *JPEGXLCoder = [SDImageJPEGXLCoder sharedCoder];\n[[SDImageCodersManager sharedManager] addCoder:JPEGXLCoder];\n```\n\n+ Swift\n\n```swift\n// Add coder\nlet JPEGXLCoder = SDImageJPEGXLCoder.shared\nSDImageCodersManager.shared.addCoder(JPEGXLCoder)\n```\n\n### Loading\n\n+ Objective-C\n\n```objective-c\n// JPEG-XL online image loading\nNSURL *JPEGXLURL;\nUIImageView *imageView;\n[imageView sd_setImageWithURL:JPEGXLURL];\n```\n\n+ Swift\n\n```swift\n// JPEG-XL online image loading\nlet JPEGXLURL: URL\nlet imageView: UIImageView\nimageView.sd_setImage(with: JPEGXLURL)\n```\n\nNote: You can also test animated JPEG-XL on UIImageView/NSImageView and WebImage (via SwiftUI port)\n\n### Decoding\n\n+ Objective-C\n\n```objective-c\n// JPEGXL image decoding\nNSData *JPEGXLData;\nUIImage *image = [[SDImageJPEGXLCoder sharedCoder] decodedImageWithData:JPEGXLData options:nil];\n```\n\n+ Swift\n\n```swift\n// JPEGXL image decoding\nlet JPEGXLData: Data\nlet image = SDImageJPEGXLCoder.shared.decodedImage(with: data, options: nil)\n```\n\n### Encoding\n\n+ Objective-c\n\n```objective-c\n// JPEGXL image encoding\nUIImage *image;\nNSData *JPEGXLData = [[SDImageJPEGXLCoder sharedCoder] encodedDataWithImage:image format:SDImageFormatJPEGXL options:nil];\n// Encode Quality\nNSData *lossyJPEGXLData = [[SDImageJPEGXLCoder sharedCoder] encodedDataWithImage:image format:SDImageFormatJPEGXL options:@{SDImageCoderEncodeCompressionQuality : @(0.1)}]; // [0, 1] compression quality\n```\n\n+ Swift\n\n```swift\n// JPEGXL image encoding\nlet image: UIImage\nlet JPEGXLData = SDImageJPEGXLCoder.shared.encodedData(with: image, format: .jpegxl, options: nil)\n// Encode Quality\nlet lossyJPEGXLData = SDImageJPEGXLCoder.shared.encodedData(with: image, format: .jpegxl, options: [.encodeCompressionQuality: 0.1]) // [0, 1] compression quality\n```\n\n### Animated JPEG-XL Encoding\n\n+ Objective-c\n\n```objective-c\n// Animated encoding\nNSMutableArray\u003cSDImageFrames *\u003e *frames = [NSMutableArray array];\nfor (size_t i = 0; i \u003c images.count; i++) {\n    SDImageFrame *frame = [SDImageFrame frameWithImage:images[i] duration:0.1];\n    [frames appendObject:frame];\n}\nNSData *animatedData = [[SDImageJPEGXLCoder sharedCoder] encodedDataWithFrames:frames loopCount:0 format:SDImageFormatJPEGXL options:nil];\n```\n\n+ Swift\n\n```swift\n// Animated encoding\nvar frames: [SDImageFrame] = []\nfor i in 0..\u003cimages.count {\n    let frame = SDImageFrame(image: images[i], duration: 0.1)\n    frames.append(frame)\n}\nlet animatedData = SDImageJPEGXLCoder.shared.encodedData(with: frames, loopCount: 0, format: .jpegxl, options: nil)\n```\n\n### Advanced jxl codec options\n\nFor advanced user who want detailed control like `cjxl` command line tool, you can pass the underlying encode options in \n\n+ Objective-C\n\n```objective-c\nNSDictionary *frameSetting = @{\n    @(JXL_ENC_FRAME_SETTING_EFFORT) : @(10),\n    @(JXL_ENC_FRAME_SETTING_BROTLI_EFFORT) : @(11)\n};\nNSData *data = [SDImageJPEGXLCoder.sharedCoder encodedDataWithImage:image format:SDImageFormatJPEGXL options:@{\n    SDImageCoderEncodeJXLDistance : @(3.0), // jxl -distance\n    SDImageCoderEncodeJXLFrameSetting : frameSetting, // jxl -effort\n}];\n```\n\n+ Swift\n\n```swift\nlet frameSetting = [\n    JXL_ENC_FRAME_SETTING_EFFORT.rawValue : 10,\n    JXL_ENC_FRAME_SETTING_BROTLI_EFFORT.rawValue : 11\n]\nlet data = SDImageJPEGXLCoder.shared.encodedData(with: image, format: .jpegxl, options: [\n    .encodeJXLDistance : 3.0, // jxl -distance\n    .encodeJXLFrameSetting : frameSetting, // jxl -effort\n]);\n```\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the root directory first. Then open `SDWebImageJPEGXLCoder.xcworkspace`.\n\nThis is a demo to show how to use JPEG-XL and animated JPEG-XL images via `SDWebImageJPEGXLCoderExample` target.\n\n## Screenshot\n\n\u003cimg src=\"https://raw.githubusercontent.com/SDWebImage/SDWebImageJPEGXLCoder/master/Example/Screenshot/JPEGXLDemo.png\" width=\"300\" /\u003e\n\nThese JPEG-XL images are from [JXL Art Gallery](https://jpegxl.info/art/)\n\n## Author\n\n[DreamPiggy](https://github.com/dreampiggy)\n\n## License\n\nSDWebImageJPEGXLCoder is available under the MIT license. See [the LICENSE file](https://github.com/SDWebImage/SDWebImageJPEGXLCoder/blob/master/LICENSE) for more info.\n\n## Thanks\n\n+ [libjxl](https://github.com/SDWebImage/libjxl-Xcode)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdwebimage%2Fsdwebimagejpegxlcoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdwebimage%2Fsdwebimagejpegxlcoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdwebimage%2Fsdwebimagejpegxlcoder/lists"}