Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could anyone tell me why UIImage.ciimage is null

Tags:

I found that in IOS UIImage can change to CIImage.and there is a property CIImage in UIImage. and when i use the UIImage,UIImage object is not null but UIImage.ciimage is null ,why?

forgive my stupid question if someone can help me ,thank you very much.


ADD

for example, the code like below return null:

UIImage *image = [UIImage imageNamed:@"test.jpg"]; CIImage *ciImage = image.CIImage 

but if in this way CIImage is not null:

UIImage *image = [UIImage imageNamed:@"test.jpg"]; CIImage *myImage = [[CIImage alloc] initWithCGImage:image.CGImage options:nil]; 
like image 332
Xoangle Avatar asked Mar 27 '13 03:03

Xoangle


1 Answers

It is because this UIImage is not in fact a CIImage. In other words, UIImage's CIImage is not nil only if the UIImage is backed by a CIImage already (e.g. because it was generated by imageWithCIImage:). You can't use this to magically turn the UIImage into a CIImage, as you seem to be hoping to do.

The documentation is actually pretty clear on this. Always worth a read.

like image 83
matt Avatar answered Sep 18 '22 16:09

matt