Post

Replies

Boosts

Views

Activity

Reply to OpenEXR conversion
I recommend using Core Image to read, write, and modify EXR images. Core Image can already natively open PNG and EXR files and write PNG data and files. However, there is no convenient way for writing EXR data of files. That's why we wrote extensions for doing exactly that. You can find them over at Github.
Topic: Media Technologies SubTopic: General Tags:
Feb ’22
Reply to QR Code Generator (CIFilter) colours for light/dark mode ?
You can use the QR code as a mask and blend it with a solid color to effectively colorize it. So you can, for example, create a black and a white version and use the register(...) method of UIImage to "bundle" them both into one dynamic image: let qrCode = filter.outputImage!.transformed(by: transform) // Use the QR code as a mask for blending with a color. // Note that we need to invert the code for that, so the actual code becomes white // and the background becomes black, because white = let color through, black = transparent. let maskFilter = CIFilter.blendWithMask() maskFilter.maskImage = qrCode.applyingFilter("CIColorInvert") // create a version of the code with black foreground... maskFilter.inputImage = CIImage(color: .black) let blackCIImage = maskFilter.outputImage! // ... and one with white foreground maskFilter.inputImage = CIImage(color: .white) let whiteCIImage = maskFilter.outputImage! // render both images let blackImage = context.createCGImage(blackCIImage, from: blackCIImage.extent).map(UIImage.init)! let whiteImage = context.createCGImage(whiteCIImage, from: whiteCIImage.extent).map(UIImage.init)! // use black version for light mode qrImage = blackImage // assign the white version to be used in dark mode qrImage.imageAsset?.register(whiteImage, with: UITraitCollection(userInterfaceStyle: .dark)) return qrImage
Topic: Media Technologies SubTopic: General Tags:
Mar ’22
Reply to CISourceOverComposition unexpected behavior
I guess this is happening because CIPhotoEffectTonal also has an effect on the transparent parts of the image. If you want to limit the effect to the visible part, you can simply crop the image after the effect is applied and before you blend it over the background: video1FilteredImage = [video1FilteredImage imageByCroppingToRect:video1FilteredImage.extent]; By the way: instead of using CIConstantColorGenerator you can simply get a colored image like this: CIImage *colorBackgroundImage = [CIImage imageWithColor:inputColor];
Topic: Media Technologies SubTopic: General Tags:
May ’22
Reply to Validation failed error code when attempting to activate a Core Media I/O extension
I encountered the same. When I re-watched the session, I heard Brad say the following: And I need to ensure here that my extension's app group is prefixed by the MachServiceName in order for it to pass validation. I changed the CMIOExtensionMachServiceName in the extension's Info.plist to the same value as my app's and extension's app group name and suddenly it passed validation. I'm not sure if this is the intended configuration. Maybe Apple's Extensions team can clarify what the "prefixed" means here and what the values should look like.
Topic: App & System Services SubTopic: Drivers Tags:
Jun ’22
Reply to Adding HDR Gain Map to HEIF/JPEG manually
I think I found the reason why the gain map isn't showing any effect: There seem to be two private {MakerApple} EXIF tags controlling the HDR effect. The one @anteo83 mentioned (0x21) seems to control the global boost to brightness. I guess via some kind of gamma curve tone mapping. But there is also the 0x30 which controls how much the embedded gain map adds to the effect. It seems to range between 0.0 and 8.0, with 0.0 having the biggest effect. When 0x30 is present, 0x21 doesn't need to be present to show the effects of the gain map. They also seem to work in tandem, with 0x21 adding to the global value and 0x30 controlling local values via gain map. There is some great fun to be had with this. Check out the attached image on your XDR or OLED device in Photos. 😁 Edit: I was trying to attach an example image here, but Forums seem to convert the image, losing the gain map in the process. You can find it here.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’22