PDA

View Full Version : In combine images, something is going wrong




vavdiyaharesh
Nov 29, 2008, 12:48 AM
Hi,

I have one image of size(320x200) an d one another image size of (100x50).

now i want to put means overwrite this smaller image on big image with size(100x80)... i have code for that like... a

{code}
CGImageRef imageRef = [[UIImage imageNamed:@"UserImage9.png"] CGImage];
CGImageRef maskRef = [[UIImage imageNamed:@"Monster.png"] CGImage];
CGImageRef mySubimage = CGImageCreateWithImageInRect (maskRef, CGRectMake(10,10,200,100));
CGImageRef combinedImage=CGImageCreateWithMask(mySubimage, imageRef);

NSString *compname = @"compImage.png";

UIImage *tempComp = [UIImage imageWithCGImage:combinedImage];

NSData *imageData = UIImagePNGRepresentation(tempComp);


NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDire ctory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *appFile = [documentsDirectory stringByAppendingPathComponent:compname];

[imageData writeToFile:appFile atomically:YES];

{code}


It is not giving me any error but also not creating combine image so anyone can tell me where i m wrong.

Thank,
Haresh.