How to change generated thumbnail color profile

In my iOS app, I'm recording a video. Later I'm generating a thumbnail from that video and saving it on device. My code looks like this:

let asset = AVAsset(url: videoUrl)
let imageGenerator = AVAssetImageGenerator(asset: asset)
imageGenerator.appliesPreferredTrackTransform = true
imageGenerator.maximumSize = CGSize(width: 1280, height: 720)
let image = try imageGenerator.copyCGImage(at: thumbnailTime, actualTime: nil)
let thumbnail = UIImage(cgImage: image)
let jpgData = thumbnail.jpegData(compressionQuality: 0.8)
try jpgData!.write(to: thumbnailUrl!)

The saved image looks good, but it has a color profile set to QuickTime 'nclc' Video (1,1,6)

enter image description here

I'm doing exactly the same thing in the Android app, and there color profile is set to sRGB

enter image description here

How can I generate a thumbnail on iOS that will have a color profile set to sRGB instead of `QuickTime 'nclc' Video (1,1,6)'?



from Recent Questions - Stack Overflow https://ift.tt/37WjsaR
https://ift.tt/37Qp6Ll

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations