문제

I am having a problem to add filter in CALayer.... here is the code but at the very end there is a line where we adding filter On CALayer..

CIImage *inputImage = [[CIImage alloc]initWithImage:[UIImage imageNamed:@"%d.jpg"]];
CIFilter *minimumComponent = [ CIFilter filterWithName:@"CIMinimumComponent"];
[minimumComponent setValue:inputImage forKey:@"inputImage"];
[minimumComponent setDefaults];

CIImage *outputImage = [minimumComponent valueForKey:@"outputImage"];
CIContext *context = [CIContext contextWithOptions:nil];
imageLayer = [UIImage imageWithCGImage:[context createCGImage:outputImage fromRect:outputImage.extent]];

I guess here is the error

imageLayer = [UIImage imageWithCGImage:[context createCGImage:outputImage fromRect:outputImage.extent]];

here is the link where i get the idea ...

도움이 되었습니까?

해결책

OK, first off I'm not 100% certain what the error you are getting is but I'd suggest changing to something like this...

CIImage *outputImage = [minimumComponent valueForKey:@"outputImage"];
UIImage *uiImage = [UIImage imageWithCIImage:outputImage];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top