2

here i’m geting the image in Img but showing nil but when i print the size of the image or display image (Img) in imageview i m getting its size and image also in imageview then when i pass the size of the image(Img) in renderer, the issue is renderer is nil i tried to print the log also but its getting Null the help will be appreciated

MY Code:

UIImage* Img =_myimage;

UIImageView * imageview = [[UIImageView alloc]initWithImage:Img];

// renderer i am getting is nil in IOS 9.3

UIGraphicsImageRenderer * renderer = [[UIGraphicsImageRenderer  alloc] initWithSize:_myimage.size];

// CGSize size=CGSizeMake(Img.size.width,Img.size.height)



   NSLog(@"renderer %@",renderer);
        UIBezierPath *Path;
        Path = [UIBezierPath bezierPath];
        Path.contractionFactor = 0.8;
        NSValue *mvalue = [_pointsarray objectAtIndex:0];
        CGPoint mp2 = [mvalue CGPointValue];
        [Path moveToPoint:mp2];
        [Path addBezierThroughPoints:_pointsarray];
        [Path closePath];
        Path.lineWidth = 2;
    CAShapeLayer*shapeLayer = [CAShapeLayer new];
    shapeLayer.path=Path.CGPath;

    [shapeLayer setFillColor:[UIColor redColor].CGColor];
    [shapeLayer fillColor];

    UIImage shapeImage = [renderer imageWithActions:^(UIGraphicsImageRendererContext  _Nonnull context){
        [shapeLayer renderInContext: context.CGContext];}];

    CIImage * shapeCimage = [[CIImage alloc]     initWithImage:shapeImage];
    CIFilter * gaussianBlurFilter = [CIFilter filterWithName:    @"CIGaussianBlur"];
    [gaussianBlurFilter setValue:shapeCimage forKey: @"inputImage"];
    [gaussianBlurFilter setValue:@7 forKey:@"inputRadius"];

    CIImage * blurredCIImage = [gaussianBlurFilter valueForKey:kCIOutputImageKey];
    UIImage * blurredImage = [UIImage imageWithCIImage:blurredCIImage];

[self.view addSubview:imageview];
Ramani Hitesh
  • 214
  • 3
  • 15

0 Answers0