*改变图像的尺寸,方便上传服务器
* &-image 待传入UIImage
* &-size 待传入UIImage要改变图像的尺寸
* 返回处理好的UIImage
*/
* &-image 待传入UIImage
* &-size 待传入UIImage要改变图像的尺寸
* 返回处理好的UIImage
*/
+ (UIImage *)scaleFromImage:(UIImage *)image toSize:(CGSize)size;
/**
* 改变图像的尺寸,方便上传服务器
*/
+ (UIImage *) scaleFromImage: (UIImage *) image toSize: (CGSize) size
{
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
* 改变图像的尺寸,方便上传服务器
*/
+ (UIImage *) scaleFromImage: (UIImage *) image toSize: (CGSize) size
{
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}