如何将cameraViewTransform应用到UIImagePickerControlleroriginalImage
我制作了自定义 UIImagePickerController 相机控件(闪光灯、前/后、变焦、拍照等)。
我的问题与缩放有关。 通过单击加号和减号按钮,我可以更改 imagePicker.cameraViewTransform 的比例。好吧在这里。
当用户选择照片时,在委托方法 didFinishPickingMediaWithInfo 中,我得到了原始图像。 显然,该 UIImage 没有应用转换。
我的问题是: 如何缩放图像(通过应用我拥有的变换)?
I made my custom UIImagePickerController camera controls (flash, front/rear, zoom, takepicture and others).
My issue is related to zooming.
By clicking plus and minus buttons, I change the imagePicker.cameraViewTransform with a scale. All right here.
When the user pick the photos, in the delegate method didFinishPickingMediaWithInfo, I get the originalImage.
That UIImage, obviously, does not have the transform applied.
My question is:
HOW DO I GET THE IMAGE SCALED (BY APPLYING THAT TRANSFORM, WHICH I HAVE) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
cameraViewTransform 仅适用于显示的(实时)图像,但不适用于捕获的图像。因此,这不会反映在捕获的图像上。
为了缩放(放大/缩小)捕获的图像,您需要对捕获的图像进行处理(记住拍照时应用的比例)。事实上,您需要缩放和旋转获得的图像以解决方向特定问题:
请参阅以下 stackoverflow 链接:
UIImagePickerController 相机预览在横向应用中为纵向
The cameraViewTransform is just for the (live)image being shown but not the image captured. Hence that wont be reflected on the image captured.
In order to Scale (Zoom in/out ) the captured image you need to work on the captured image (remember the scale applied while taking picture). As a matter of fact you need to scale and rotate the obtained image for orientation specific issues :
see the following stackoverflow link :
UIImagePickerController camera preview is portrait in landscape app