自定义相机变焦功能 iPhone 拍照
我成功地能够使用自定义相机视图中的滑块使用以下代码进行自定义缩放,
imagePickerController.cameraViewTransform = CGAffineTransformScale(initialTransform, MainSlider.value, MainSlider.value);
屏幕看起来应该是这样的缩放... 但是,当我调用拍照功能
[self.imagePickerController takePicture];
并尝试在方法中访问照片时:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *Originalimage = [info valueForKey:UIImagePickerControllerOriginalImage];
UIImage *Editimage = [info valueForKey:UIImagePickerControllerEditedImage];
}
这里我收到没有缩放的原始图像“Originalimage”,但我在“Editimage”中没有得到任何内容,
我正在尝试使用cameraViewTransform获取带有缩放的图像!
我希望现在更清楚了......
谢谢
I am successfully able to Make custom Zoom using Slider in my Custom Camera view using following code
imagePickerController.cameraViewTransform = CGAffineTransformScale(initialTransform, MainSlider.value, MainSlider.value);
Screen Looks Zoom as it should be ...
But when i call Take Picture function
[self.imagePickerController takePicture];
and tryng to access Photo in method :
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *Originalimage = [info valueForKey:UIImagePickerControllerOriginalImage];
UIImage *Editimage = [info valueForKey:UIImagePickerControllerEditedImage];
}
Here I receive Original Image without Zoom n "Originalimage" but i dont get anything in "Editimage"
I am trying to get Image with Zoom that i get using cameraViewTransform!!
I hope its more clear now ... .
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧..我有间接的方法来获取缩放图像....
一旦我缩放图像并拍照,我就拍摄原始照片并将该图像缩放到该比例...然后使用此功能
所选边界的“UIGraphicsGetImageFromCurrentImageContext”...
我得到了缩放图像...
我仍然不知道为什么我在 UIImagePickerControllerEditedImage 中没有得到任何内容,可能我没有编辑任何内容...只是缩放它...可能这就是为什么它的原因编辑图像中没有给我任何内容...
感谢您的帮助和支持!
Ok .. I got indirect way to get the zoomed image ....
Once i zoom image and take picture , I take the Originial picture and zoom that Image upto that scale ... and than use of this function
"UIGraphicsGetImageFromCurrentImageContext" for selected bound ...
And i get that zoomed image ...
Still i dont know why i dont get anything in UIImagePickerControllerEditedImage , May be i am editing nothing... just scaling it ... may be thats why its not giving me anythiing in Edited Image ...
Thank you for your help and support !!