In order to prevent their hard work to be stolen away by others, take pictures to add watermarks, this represents the unique picture. Add a watermark is not added a few labels above, but we put the calligraphy to the picture to become a whole, the following small series to share iOS to the picture to add watermark (two ways).
Provides a way to achieve this by simply passing the content of a picture and watermark to be added to the watermark.
The first way:
The second way: with Drawinrect is very convenient, pictures, text can be added
Draw Watermark
-(UIImage *) Imagewithwatermask: (uiimage*) Mask inrect: (cgrect) rect
{
#if __iphone_os_version_max _allowed >= 40000
if ([[[Uidevice Currentdevice] systemversion] floatvalue] >= 4.0)
{
Uigraphicsbeginimagecontextwithoptions ([Self size], NO, 0.0); 0.0 for scale means "scale for device ' s main screen".
}
#else
if ([[[[Uidevice Currentdevice] systemversion] Floatvalue] < 4.0)
{
Uigraphicsbeginimagecontext ([self size]);
}
#endif
//original artwork
[self drawinrect:cgrectmake (0, 0, Self.size.width, self.size.height)];
Watermark Map
[mask drawinrect:rect];
UIImage *newpic = Uigraphicsgetimagefromcurrentimagecontext ();
Uigraphicsendimagecontext ();
return newpic;
The above description in two ways to achieve iOS to add watermark to the picture, need friends can refer to, I hope you can enjoy.