0

i am working on app which allow to capture image from cam or select from photo library, after that it allow to select some options like what border color to apply, border width, rounded or square corners, what size user want like 45*45mm or 70*70mm etc and text user wants to apply at the bottom of this whole image and then app will save it as a whole image.

For border colour, border width, border corner i have create images in photoshop of different colour.

I am stuck at that how should i approach or how should i apply border properties and image captured and text to create a whole new image and save it. And how to apply 45*45mm or 70*70mm different sizes to the image.

supera
  • 580
  • 5
  • 13

1 Answers1

2

Example code for adding one image to another one

- (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];
}

logo always lies on center


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

NeverBe
  • 5,213
  • 2
  • 25
  • 39
  • can u also tell me if i want to create borders programatically with out using any predefine images. – supera Feb 10 '12 at 10:57
  • http://stackoverflow.com/questions/1354811/how-can-i-take-an-uiimage-and-give-it-a-black-border – NeverBe Feb 10 '12 at 11:35