[英]iPhone camera and photo editing options - integration on custom app
I am right now on the phase of recollecting information for a new iPhone app. 我现在正在为新的iPhone应用程序收集信息的阶段。 For this app, i would like to use the camera and photo image editing options. 对于此应用程序,我想使用相机和照片图像编辑选项。 Is Apple offering API (controller) where i can use this integrated IOs features into my app? Apple是否提供API(控制器),可以在其中将集成的IO功能用于我的应用程序中? i mean, in a process that starts first using the iPhone camera (IOS feature), later using the photo editing options (IOS feature), compress and tagg it (personal features), and finally save it inside my personal app folder/library (not inside general photo library)? 我的意思是,首先开始使用iPhone相机(IOS功能),然后使用照片编辑选项(IOS功能),对其进行压缩和标记(个人功能),最后将其保存在我的个人应用程序文件夹/库中(不在普通照片库中)?
I have been reading the UIImagePickerController class feature, but i would like to double check with you, before moving forward 我一直在阅读UIImagePickerController类功能,但在继续前进之前,我想与您再次确认
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
any idea for compressing the image or capturing it with less resolution? 有压缩图像或以较低分辨率捕获图像的想法吗?
thank you very much in advance 提前非常感谢你
Instead of capturing the image with less resolution you can resize image in the callBack of UIImagePickerController which is 您可以在UIImagePickerController的callBack中调整图像的大小,而不必用较低的分辨率捕获图像。
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
UIImage *temp = (UIImage*)[info objectForKey:@"UIImagePickerControllerOriginalImage"];
UIImage *uploadImage = [self resizeImageWithImage:temp];
}
For resizing function : 对于调整大小功能:
- (UIImage*)resizeImageWithImage:(UIImage*)image {
CGSize newSize = CGSizeMake(newWidth, newHeight);
UIGraphicsBeginImageContext( newSize );
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
You may need to use : 您可能需要使用:
#import <QuartzCore/QuartzCore.h>
and the library. 和图书馆。
Also for image editing check for CoreImage library which you can get information from here 另外,对于图像编辑,请检查CoreImage库,您可以从此处获取信息
http://developer.apple.com/library/mac/#documentation/graphicsimaging/Conceptual/CoreImaging/ci_intro/ci_intro.html http://developer.apple.com/library/mac/#documentation/graphicsimaging/Conceptual/CoreImaging/ci_intro/ci_intro.html
For compressing this might help 对于压缩,这可能会有所帮助
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *imageData = UIImageJPEGRepresentation(image, 0.6);
//0 means most compression
//1 means least compression
}
UIImagePickerController will let user either select existing photo or take a new one (it depends on how you set up the controller). UIImagePickerController将允许用户选择现有照片或拍摄新照片(这取决于您如何设置控制器)。 The only editing that this approach allows is for user to crop the image. 该方法唯一允许的编辑是用户裁剪图像。 Other than that, you'll have to provide your own features. 除此之外,您还必须提供自己的功能。
As for compressing the image, you can save it as JPG while defining the compression ratio like so: 至于压缩图像,您可以在定义压缩率的同时将其另存为JPG,如下所示:
NSData *dataForPNGFile = UIImageJPEGRepresentation(yourImage, 0.9f);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.