Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Image programmatically in Objective-C [closed]

I want to know is it is possible to create a blank image programmatically in Objective-C (Mac osx)? My requirement is I want to create a watermark, so one source image is there.. But i need to create an another image and add some text to that image and bind the second image with the first one so that it will display as a watermark. Is it is possible to create an image like that? i know how to merge two images. I don't know how to create an image programmatically and add some text on it.

like image 258
Jio Avatar asked Feb 15 '23 08:02

Jio


1 Answers

You can create a blank png using:

// The NO here is the opaque parameter. You can set it to YES according to your needs.
UIGraphicsBeginImageContextWithOptions(CGSizeMake(150, 150), NO, 0.0);
UIImage *blankImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
like image 61
Nikos M. Avatar answered Feb 19 '23 01:02

Nikos M.