0

How to blend two images by changing alfa of only one image so that the upper image will be slightly transparent and the above image will be displayed as it is drawn on the background image.

Prerna chavan
  • 3,179
  • 7
  • 35
  • 77

1 Answers1

0

You can do it through imageView alpha property

imageView.alpha = 0.0f;

Detailed code:

   UIImage *bottomImage = [UIImage imageNamed:@"bottomImage.png"];
    UIImage *topImage = [UIImage imageNamed:@"topImage.png"];

    CGSize newSize = CGSizeMake(width, height);
    UIGraphicsBeginImageContext( newSize );

    // Use existing opacity as is
    [bottomImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
    // Apply supplied opacity
    [topImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height) blendMode:kCGBlendModeNormal alpha:0.8];

    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

see more details here

Community
  • 1
  • 1
Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102