相关疑难解决方法(0)

问题设置图像的exif数据

我在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)

iphone macos exif core-graphics javax.imageio

55
推荐指数
3
解决办法
3万
查看次数

在IOS 6.0或iPhone上传时,捕获的照片会自动旋转

我有一个HTML文件控件使用这个我试图在服务器上传文件.

  • 单击文件控件
  • 它将自动打开文件/摄像机选择对话框.
  • 我选择相机
  • 我拍摄照片并保存
  • 现在提交表格
  • Capture照片在服务器上成功保存但旋转90度.

此问题仅适用于iPhone或IOS.

<input id="image" name="image" type="file" accept="image/*" capture style="width: 58px" />
Run Code Online (Sandbox Code Playgroud)

请告诉我,如果从相机捕获图像,如何停止自动旋转图像.

谢谢,Imdadhusen

file-upload image form-submit ios

19
推荐指数
1
解决办法
2万
查看次数

强制UIImagePickerController以纵向/尺寸iOS拍摄照片

我的应用中唯一允许的方向是横向.我在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 xcode orientation uiimagepickercontroller

10
推荐指数
1
解决办法
1万
查看次数