默认情况下,当我们从ios相册中获取图像时,它总是会被剪裁。
然而,如果我们使用UIImagePickerControllerOriginalImage,那么它太大了。
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage*temp =[info objectForKey:UIImagePickerControllerEditedImage];
}
有没有好的方法来编辑图像而不剪切它的范围?
答案 0 :(得分:0)
也许是这样......
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage*temp =[info objectForKey: UIImagePickerControllerOriginalImage];
CGSize newSize = CGSizeMake("WIDTH", "HEIGHT"); <---- SET YOUR VALUES
UIGraphicsBeginImageContext(newSize);
[temp drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* smaller = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}