Closed r-plus closed 1 year ago
Makes sense, I can investigate soon. Can you (or anyone) confirm whether AVIF decoding is exposed to UIImage
/ NSImage
/ CGImage
and on what platforms? WebP was weird because only iOS / macOS supported it and tvOS / watchOS didn't.
I just try to show AVIF basic image (YUV420, 8bit depth) from https://github.com/link-u/avif-sample-images by this code. It displayed hato image on iOS 16.0.3, iPhone 14 Pro device.
struct ContentView: View {
var body: some View {
let url = URL(string: "https://raw.githubusercontent.com/link-u/avif-sample-images/master/hato.profile0.8bpc.yuv420.avif")!
AsyncImage(url: url) { image in
image.resizable()
.scaledToFit()
} placeholder: {
ProgressView()
}
}
}
additionally, check the UIImage
too.
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "https://raw.githubusercontent.com/link-u/avif-sample-images/master/hato.profile0.8bpc.yuv420.avif")!
let v = UIImageView(frame: .init(x: 0, y: 0, width: 300, height: 300))
self.view.addSubview(v)
Task {
let result = try! await URLSession.shared.data(for: URLRequest(url: url))
let image = UIImage.init(data: result.0)!
v.image = image
}
}
not yet upgrade to macOS Ventura to check this.
SwiftUI
and NSImage
correctly displayed avif image on macOS Ventura.
SwiftUI
NSView
Looks like AVIF is supported on macOS, iOS, and tvOS (unlike WebP still), but not watchOS. I've got the change but I need to update and deploy a new version of the test server along with a significant testing refactor for the new OSes, so it'll be a little while before this can get released.
Sorry for the long delay. This has been merged, along with JPEG XL support on the 2023 OSes, in #464 and should go out with the next release.
What did you do?
iOS 16 and macOS Ventura start support AVIF image type so this feature request want adding
image/avif
to request Accept header as dynamic similar toimage/webp
support.I'm not sure about tvOS and watchOS are support AVIF on latest version.
What did you expect to happen?
image/avif
string contained in accept header when running OS is iOS 16 or macOS Ventura.What happened instead?
Not yet added.
Alamofire Environment
Alamofire Image version: 4.2.0
Demo Project
N/A