Add text to image

Hi

I am currently developing an application in which I need to add text on top of the image at any position on the image (not a preview), and the output should be the only image file with the original image and the text embedded in it, any help will be noticeable.

for example: water sign in the image

Thanks sivasankar

+3
source share
1 answer
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, watermarkedImage will be a self-implemented watermark. loadUnwatermarkedImage () is a fictitious function that provides the original image.

+11
source

Source: https://habr.com/ru/post/1732479/


All Articles