UIImage to CIImage - size is halved?
Asked Answered
A

1

13

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

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

Comparing someCIImage.extent.size.width/height with someUIImage.size.width/height, I find that sometimes the CIImage is double size in dimensions, and sometimes its the same size as the 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.

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.

Arawakan answered 2/7, 2012 at 21:37 Comment(3)
I wonder if this has to do with Retina Display graphics?Foin
Check the scale method of the UIImage; it should tell you how to convert the size to pixels.Dysthymia
I am having the same problem when messing around with a CIFilter. Before using the filter I partly use UIImage to CIImage converts. Your comment helped me, but still got some problem to figure out the CIFilter in the end. UIImage-property-scale indeed is 2 at retina devices.Thirzia
D
8

size has to do with the distance between points on the display, as so the number of points on a retina display are doubled. size does not represent the number of pixels as you assumed.

Doykos answered 24/8, 2013 at 22:33 Comment(2)
As to what to do about it, you will need to scale your image as pointed out in the above comments.Shophar
try to give solution pleasePirri

© 2022 - 2024 — McMap. All rights reserved.