Create a completely new image in iOS by selecting various properties

I'm working on an application that allows you to capture an image from a camera or select from a library of photos, after which it allows me to choose some parameters, for example, what border color is applied, frame width, rounded or square corners, what size the user needs as 45 * 45 mm or 70 * 70 mm, etc., And the text user wants to apply the bottom of this image, and then the application will save it as a whole image.

For border color, border width, border corner, I create images in Photoshop with different colors.

I'm stuck with this, how do I fit, and how should I apply the border properties and the image captured and the text to create a completely new image and save it. And how to apply to the image 45 * 45 mm or 70 * 70 mm in different sizes.

0
ios
Feb 10 2018-12-12T00:
source share
1 answer

Sample code to add one image to another

- (void)drawRect:(CGRect)rect { UIImage *bottomImage = [[UIImage imageNamed:@"background.png"] stretchableImageWithLeftCapWidth:20 topCapHeight:0]; UIImage *image = [UIImage imageNamed:@"logo.png"]; CGSize newSize = CGSizeMake(rect.size.width, rect.size.height); UIGraphicsBeginImageContextWithOptions(newSize, NO, [UIScreen mainScreen].scale); [bottomImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; [image drawAtPoint:CGPointMake((int)((newSize.width - image.size.width) / 2), (int)((newSize.height - image.size.height) / 2))]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [newImage drawInRect:rect]; } 

the logo is always in the center




For resizing and rounding images I use http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/

+2
Feb 10 '12 at 8:16
source share



All Articles