我想从文档目录中获取图像,然后旋转并将更改反射(reflect)到文档目录中的同一图像文件中。
我正在使用这样的图像路径获取图像
[UIImage imageWithContentsOfFile:imgURL];
我想将这张图片旋转 90 度,并以相同的图片名称保存在相同的路径中。
最佳答案
UIImage *image = [UIImage imageWithContentsOfFile:imgURL];
UIImage *newImage=[image imageRotatedByDegrees:90.0]; // i guess "image" is your orginal image
[[NSFileManager defaultManager] removeItemAtPath:imgURL];
[UIImageJPEGRepresentation(newImage) writeToFile:imgURL atomically:YES];
关于ios - 如何将图像旋转90度并保存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19900257/