Adela Toderici
Adela Toderici

Reputation: 1112

How to find the size of iphone camera photo and how can I resize it?

I took camera photo and a library photo on my app and I have to send it on the server. So I want to know which is the size of the photo and I want to restrict the number of it's pixels. Can anybody help me?

Upvotes: 1

Views: 883

Answers (1)

Adela Toderici
Adela Toderici

Reputation: 1112

    UIImage *originalImage = [UIImage imageNamed:@"minions.png"];
    CGSize destination = CGSizeMake(40, 40);
    UIGraphicsBeginImageContext(destination);
    [originalImage drawInRect:CGRectMake(0,0,destination.width,destination.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    UIImageView *New = [[UIImageView alloc] initWithFrame:CGRectMake(40, 40, 40, 40)];
    New.image = newImage;
    [self.view addSubview:New];

This is my solution.

Upvotes: 1

Related Questions