You can use the CoreGraphics ' UIImagePNGRepresentation(UIImage *image) method, which returns an NSData and saves it. and if you want to convert it to UIImage , create it using the [UIimage imageWithData:(NSData *data)] method.
Demo of sending your UIImage to the server
- (void)sendImageToServer { UIImage *yourImage= [UIImage imageNamed:@"image.png"]; NSData *imageData = UIImagePNGRepresentation(yourImage); NSString *postLength = [NSString stringWithFormat:@"%d", [imageData length]];
source share