uiimagepickercontroller

Set minimum zoom level for UIImagePickerController cropping

戏子无情 提交于 2019-11-30 17:10:31
问题 I am using a UIImagePickerController to allow the user to upload a photo for use in my application. After selecting a photo to upload, the user is then prompted to crop his/her photo (since I have set imagePickerController.allowsEditing = YES ). However, if the photo is landscape (i.e., wider than it is taller), it is currently possible for the user to crop the photo in a way that does not output a square image. This is because the default zoom level when cropping landscape photos is

Good way to calculate 'brightness' of UIImage?

十年热恋 提交于 2019-11-30 16:33:43
I'm writing an app that will offer OCR of an image captured by the iPhone camera. I want to test the image before I perform the OCR analysis to see if there is sufficient lighting. Anyone have any ideas? The most flexible way is to generate a histogram for the red green and blue color channels, and then use it to determine the average lightness, median lightness, black/white points, contrast or other custom functions. Use CGBitmapContextCreate to create a bitmap context backed by a buffer of your creation, draw your image into it, then loop through each pixel in the buffer to populate the

Memory Troubles with UIImagePicker

佐手、 提交于 2019-11-30 16:27:28
I'm building an app that has several different sections to it, all of which are pretty image-heavy. It ties in with my client's website and they're a "high-design" type outfit. One piece of the app is images uploaded from the camera or the library, and a tableview that shows a grid of thumbnails. Pretty reliably, when I'm dealing with the camera version of UIImagePickerControl, I get hit for low memory. If I bounce around that part of the app for a while, I occasionally and non-repeatably crash with "status:10 (SIGBUS)" in the debugger. On low memory warning, my root view controller for that

Calling imageWithData:UIImageJPEGRepresentation() multiple times only compresses image the first time

半世苍凉 提交于 2019-11-30 16:21:49
In order to prevent lagging in my app, I'm trying to compress images larger than 1 MB (mostly for pics taken from iphone's normal camera. UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; NSData *imageSize = UIImageJPEGRepresentation(image, 1); NSLog(@"original size %u", [imageSize length]); UIImage *image2 = [UIImage imageWithData:UIImageJPEGRepresentation(image, 0)]; NSData *newImageSize = UIImageJPEGRepresentation(image2, 1); NSLog(@"new size %u", [newImageSize length]); UIImage *image3 = [UIImage imageWithData:UIImageJPEGRepresentation(image2, 0)]; NSData

Good way to calculate 'brightness' of UIImage?

▼魔方 西西 提交于 2019-11-30 16:18:34
问题 I'm writing an app that will offer OCR of an image captured by the iPhone camera. I want to test the image before I perform the OCR analysis to see if there is sufficient lighting. Anyone have any ideas? 回答1: The most flexible way is to generate a histogram for the red green and blue color channels, and then use it to determine the average lightness, median lightness, black/white points, contrast or other custom functions. Use CGBitmapContextCreate to create a bitmap context backed by a

How to get UIImagePicker selected image name?

大城市里の小女人 提交于 2019-11-30 16:04:53
Does anyone know how to get the selected image name (the one from photo gallery) after presenting an UIImagePickerController? With the help of ALAsset you can able to achieve this. Step 1: Get the Asset for the selected Image from the UIImagePicker Step 2: Get the ALAssetRepresentation for that Asset . Step 3: ALAssetRepresentation class has a property called fileName - (NSString *)filename Returns a string representing the filename of the representation on disk. This Sample Code will Helps you... - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:

swift: How to load photos from photo library without using UIImagePickerController?

大兔子大兔子 提交于 2019-11-30 14:07:33
问题 I am using swift to load images from photo library. I know that I can use UIImagePickerController to let user to choose the images from camera roll but I want to access photos without user actions. For example, I want to read a series of photos which are from camera roll and put them in a photo slide to show them one by one. How can I access these photos without UIImagePickerController? 回答1: You can access photo library using Photos framework(for iOS 8+). Take a look at this example. In

iPhone - Remove status bar programmatically

北战南征 提交于 2019-11-30 13:45:22
I have made an app that implements the iPhone's camera. When the user finishes picking their image, the status bar reappears! How would I make sure that the status bar stays hidden? Here is my code: -(IBAction)pickImage:(id)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; [self presentModalViewController:picker animated:YES]; } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker

Camera differences between UIImagePickerController and AVCaptureSession on iPhone

[亡魂溺海] 提交于 2019-11-30 12:33:48
问题 I'm trying to build a replacement for UIImagePickerController , using AVCaptureSession with AVCaptureDeviceInput and AVCaptureStillImageOutput , as input/output respectively. To preview the camera stream I'm using AVCaptureVideoPreviewLayer . It's now working correctly for capturing and storing photos just like the default camera. However, I found 3 problems I was unable to solve: photos captured don't get the same quality the default camera provides the viewing/capture angle is shortened,

UIImagePickerController returning incorrect image orientation

十年热恋 提交于 2019-11-30 11:37:37
问题 I'm using UIImagePickerController to capture an image and then store it. However, when i try to rescale it, the orientation value i get out of this image is incorrect. When i take a snap by holding the phone Up, it gives me orientation of Left. Has anyone experienced this issue? The UIImagePickerController dictionary shows following information: { UIImagePickerControllerMediaMetadata = { DPIHeight = 72; DPIWidth = 72; Orientation = 3; "{Exif}" = { ApertureValue = "2.970853654340484";