在我的应用程序中,如果用户从相机胶卷中选择图像用作公司徽标(添加到最终 pdf 中),在某些情况下,它可以将附件大小从 8mb(无图像)变为 29mb。当用户通过电子邮件发送文件时,这是一个问题,因为它比大多数服务器都允许附件大小
- (IBAction)schemeLogoPressed:(id)sender {
LogCmd();
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = NO;
[self.editController presentModalViewController:imagePicker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
DebugLog(@"info dict: %@", info);
[picker dismissModalViewControllerAnimated:YES];
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
self.schemeLogo.backgroundColor = [UIColor whiteColor];
self.schemeLogo.image = image;
NSData *imageData1 = UIImagePNGRepresentation(image);
NSString *path1 = [ICUtils pathForDocument:@"schemeLogo.png"];
[imageData1 writeToFile:path1 atomically:NO];
我能做些什么来优化挑选的图像尺寸吗?