Reputation: 1412
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
Upvotes: 3
Views: 3922
Reputation: 23722
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.
Upvotes: 11