1
0
mirror of https://github.com/danog/Telegram.git synced 2024-11-30 04:29:15 +01:00
Telegram/Share/TGScaleImage.m
2015-10-01 19:19:52 +03:00

12 lines
409 B
Objective-C

#import "TGScaleImage.h"
UIImage *TGScaleImage(UIImage *sourceImage, CGSize pixelSize)
{
UIGraphicsBeginImageContextWithOptions(pixelSize, true, 1.0f);
[sourceImage drawInRect:CGRectMake(0.0f, 0.0f, pixelSize.width, pixelSize.height) blendMode:kCGBlendModeCopy alpha:1.0f];
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return result;
}