How to check a image selected is Panorama image or Not

前端 未结 2 773
不知归路
不知归路 2021-01-23 01:37

How to check, the image selected from UIImagePickerController is a Panorama Image or not?

2条回答
  •  感情败类
    2021-01-23 02:23

    In this UIImagePickerController delegate method (be sure to add delegate methods to your View Controller class):

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
      [self dismissViewControllerAnimated:YES completion:NULL];
      UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];   
    
      // determine if it's panorama by checking its dimension
      CGFloat imageWidth = image.size.width;
      CGFloat imageHeight = image.size.height;
    
      // display the image if needed
      [self.imageView setImage:image];
    
      self.imagePickerController = nil;
    }
    

    Theoretically panorama images have much longer width than normal image. But this can't check if it is a web image downloaded from elsewhere.

提交回复
热议问题