zgjie
zgjie

Reputation: 2260

How to display an HDR photo like in Photos app, that the highlight and shadow parts are shown in different brightness?

iPhone cameras can capture HDR photos, and when shown in the Photos app in OLDE iPhones, the HDR photo will be shown with different brightness for light and dark parts. The effect is shown in this tweet https://twitter.com/5tu/status/1327838250170368000 (although it is a video, the same applies to photos), the bright part of an HDR photo will show white brighter than the app's background white.

I cannot achieve this effect with UIImageView. How to achieve this effect for an HDR photo programmatically?

Upvotes: 0

Views: 1325

Answers (3)

闪电狮
闪电狮

Reputation: 556

In Xcode 16, this can be done through SwiftUI:

let image:UIImage = UIImageReader.default.image(contentsOf: URL(string: "yourHDRImageURL")!)!
var body: some View {
    Image(uiImage: image)
        .resizable()
        .aspectRatio(contentMode: .fit)
        .allowedDynamicRange(.high)
}

References:https://developer.apple.com/wwdc24/10177?time=1664

Upvotes: 0

Memtimen
Memtimen

Reputation: 86

This is a same question: https://www.reddit.com/r/photography/comments/ni6603/iphone_photos_more_hdr_gets_brighter_than/

This app does what you looking for: https://apps.apple.com/us/app/radiance/id1573366225

this is documentation: https://developer.apple.com/videos/play/wwdc2022/10114/

you cannot do that with UIImageView, you need Metal.

Upvotes: 1

although it is a video, the same applies to photos

What? Only AVIF and JPEG XL support HDR tranfer functions.

Upvotes: 0

Related Questions