Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CGWindowListCreateImage创建每像素4字节的图像。如何将其更改为每像素3字节?_C_Xcode_Macos_Cocoa - Fatal编程技术网

CGWindowListCreateImage创建每像素4字节的图像。如何将其更改为每像素3字节?

CGWindowListCreateImage创建每像素4字节的图像。如何将其更改为每像素3字节?,c,xcode,macos,cocoa,C,Xcode,Macos,Cocoa,通过调用CGWindowListCreateImage获得的屏幕捕获是RGBA图像 如何强制它返回RGB格式的图像(每像素3字节) 谢谢你 CGImage不支持没有alpha通道的格式。即使是kgimagealphanone也只是表示“忽略alpha位” 如果您想要24位图像格式,您需要自己进行转换。vImage具有高效完成此任务的例程。例如,可以使用将ARGB转换为RGB

通过调用CGWindowListCreateImage获得的屏幕捕获是RGBA图像

如何强制它返回RGB格式的图像(每像素3字节)


谢谢你

CGImage
不支持没有alpha通道的格式。即使是
kgimagealphanone
也只是表示“忽略alpha位”

如果您想要24位图像格式,您需要自己进行转换。vImage具有高效完成此任务的例程。例如,可以使用将ARGB转换为RGB