xcode UIImage 到 CIImage - 大小减半?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11301560/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:45:40  来源:igfitidea点击:

UIImage to CIImage - size is halved?

objective-ciosxcodeuiimagecore-image

提问by HHHH

I'm creating a CIImage from a UIImage as follows:

我正在从 UIImage 创建 CIImage ,如下所示:

CIImage* someCIImage = [CIImage imageWithCGImage:someUIImage.CGImage];

Comparing someCIImage.extent.size.width/heightwith someUIImage.size.width/height, I find that sometimes the CIImage is double size in dimensions, and sometimes its the same size as the UIImage.

比较someCIImage.extent.size.width/heightsomeUIImage.size.width/height,我发现有时CIImage在尺寸两倍大小,有时它的大小相同的UIImage的。

It seems like if the UIImage is slightly larger, the CIImage is double the size, whereas if the UIImage is slightly smaller this isn't the case.

看起来如果 UIImage 稍大,CIImage 的大小是两倍,而如果 UIImage 稍小,则情况并非如此。

Has anyone seen this before/know why this is? This is causing me real trouble as I'm trying to draw a CIImage from a loaded UIImage.

有没有人以前见过这个/知道这是为什么?这给我带来了真正的麻烦,因为我试图从加载的 UIImage 中绘制 CIImage。

采纳答案by Pétur Ingi Egilsson

sizehas to do with the distance between points on the display, as so the number of points on a retina display are doubled. sizedoes notrepresent the number of pixels as you assumed.

size与显示器上点之间的距离有关,因此视网膜显示器上的点数加倍。size没有代表你假设的像素数。