- (UIImage *)imageFromImage:(UIImage *)image {
CGSize size = image.size;
CGRect rect = CGRectZero;
rect.size = size;
rect.origin.x = (size.width - size.height) / 2;
rect.size.width -= 2 * rect.origin.x;
CGImageRef sourceImageRef = [image CGImage];
CGImageRef newImageRef = CGImageCreateWithImageInRect(sourceImageRef, rect);
UIImage *newImage = [UIImage imageWithCGImage:newImageRef];
return newImage;
}