最近的iPhone PNG截图cgImage是黑色

时间:2018-05-18 09:32:10

标签: ios iphone swift

我使用以下代码将我的图库中的图像添加到我的视频编辑应用中:

// add image
let overlayLayerLogo: CALayer = CALayer()
overlayLayerLogo.contents = params.logo.cgImage
let imageSize = params.logo.size
overlayLayerLogo.frame = CGRect(x: 30, y: 30, width: imageSize.width, height: imageSize.height)
overlayLayerLogo.masksToBounds = true
parentLayer.addSublayer(overlayLayerLogo)

在大多数情况下它运行良好,但不适用于iPhone 8截取的屏幕截图:

iPhone 6S Plus - Picture taken by the camera => OK
iPhone 6S Plus - Screenshot => OK
iPhone 6S Plus - Screenshot converted to JPEG => OK
iPhone 8 - Picture taken by the camera => OK
iPhone 8 - Screenshot => KO : The image is all black
iPhone 8 - Screenshot converted to JPEG => OK

我不知道具体的格式吗?

我尝试更改图片格式设置(HEIF / JPEG),但屏幕截图不会改变任何内容

0 个答案:

没有答案