我在iOS 4.1中使用新的ImageIO框架.我使用以下代码成功检索exif元数据:
CFDictionaryRef metadataDict = CMGetAttachment(sampleBuffer, kCGImagePropertyExifDictionary , NULL);
Run Code Online (Sandbox Code Playgroud)
阅读它,它似乎是有效的.保存图像有效,但图像中从不存在任何exif数据.
CGImageDestinationRef myImageDest = CGImageDestinationCreateWithURL((CFURLRef) docurl, kUTTypeJPEG, 1, NULL);
// Add the image to the destination using previously saved options.
CGImageDestinationAddImage(myImageDest, iref, NULL);
//add back exif
NSDictionary *props = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:.1], kCGImageDestinationLossyCompressionQuality,
metadataDict, kCGImagePropertyExifDictionary, //the exif metadata
nil];
//kCGImagePropertyExifAuxDictionary
CGImageDestinationSetProperties(myImageDest, (CFDictionaryRef) props);
// Finalize the image destination.
bool status = CGImageDestinationFinalize(myImageDest);
Run Code Online (Sandbox Code Playgroud) 我有一个HTML文件控件使用这个我试图在服务器上传文件.
此问题仅适用于iPhone或IOS.
<input id="image" name="image" type="file" accept="image/*" capture style="width: 58px" />
Run Code Online (Sandbox Code Playgroud)
请告诉我,如果从相机捕获图像,如何停止自动旋转图像.
谢谢,Imdadhusen
我的应用中唯一允许的方向是横向.我在target> summery下的项目属性中强制执行此操作,并且仅允许纵向显示shouldAutorotateToInterfaceOrientation
问题是当我在水平握住手机(横向)的同时拍照时,照片将以横向拍摄,而UI仍处于纵向模式.
这意味着在横向模式下,我得到了3264 x 2448的宽图像,而不是我在纵向模式下的高图像(2448 x 3264).
接下来,用户可以裁剪图像,但如果以横向模式拍摄图像,我会得到非常难看的拉伸图像.添加边框或将UI切换为横向不是一种选择.
UIImagePickerController即使手机水平放置(横向模式),有没有办法强制以纵向尺寸拍摄照片?
我UIImagePickerController使用以下设置初始化:
imagePicker =[[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
imagePicker.showsCameraControls = NO;
imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;
imagePicker.wantsFullScreenLayout = YES;
imagePicker.cameraViewTransform = CGAffineTransformScale(imagePicker.cameraViewTransform,CAMERA_TRANSFORM, CAMERA_TRANSFORM);
imagePicker.navigationBarHidden = YES;
imagePicker.toolbarHidden = YES;
[self presentModalViewController:imagePicker animated:NO];
imagePicker.cameraOverlayView = self.cameraOverlay;
imagePicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
Run Code Online (Sandbox Code Playgroud) iphone ×2
exif ×1
file-upload ×1
form-submit ×1
image ×1
ios ×1
macos ×1
orientation ×1
xcode ×1