You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your UIImage has transparency you end up with a black background despite HEIC being supposed to support transparency (and the docs saying the default bg color when the format doesn't support transparency is supposed to be white) - any ideas on how to fix this? I've played around for a couple hours and haven't come up with anything.
The text was updated successfully, but these errors were encountered:
@barrettj can you paste a code snippet of how exactly you're doing this? If you're using the UIGraphicsImageGenerator category you need to specify that the image shouldn't be opaque.
I was using tj_UIImageHEICRepresentation (and custom versions of the method where I was trying different CGImageDest commands to get it to keep the transparency without success)
I did get it working, but not with the CGImageDestinationCreateWithData family. I had to use AVFoundation code like the following:
guard let cgImage = cgImage else {
return nil
}
let ciImage = CIImage.init(cgImage: cgImage)
let context = CIContext()
let heicData = context.heifRepresentation(of: ciImage, format: kCIFormatABGR8, colorSpace: ciImage.colorSpace!, options: [:])
return heicData
If your UIImage has transparency you end up with a black background despite HEIC being supposed to support transparency (and the docs saying the default bg color when the format doesn't support transparency is supposed to be white) - any ideas on how to fix this? I've played around for a couple hours and haven't come up with anything.
The text was updated successfully, but these errors were encountered: