views:

103

answers:

1

HI

Im currently developing an application where i have to add the text over the image at any position in the image(not subview) and the output should be the single image file with the original image and the text embedded in it,any help will be appreciable.

eg : water mark on the image

Thanks sivasankar

+2  A: 
UIImage *myImage = loadUnwatermarkedImage();
NSString *myWatermarkText = @"Watermark";
UIImage *watermarkedImage = nil;

UIGraphicsBeginImageContext(myImage.size);
[myImage drawAtPoint: CGPointZero];
[myWatermarkText drawAtPoint: CGPointMake(10, 10) withFont: [UIFont systemFontOfSize: 12]];
watermarkedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Upon completion the watermarkedImage will be an autoreleased watermarked image. loadUnwatermarkedImage() is a fictional function providing an original image.

Costique
Thanks Costique,it works.pls get your mail id to ask the doubt directly through mail / chat
siva