Pierre
Pierre

Reputation: 11673

UIImagePicker and UIImage size

I have an UIImagePickerViewController and I'm saving my image to my app just with UIImagePickerControllerOriginalImage and :

[self.fileManager createFileAtPath:aPath contents:UIImageJPEGRepresentation(image, 1.f) attributes:nil];

Result :

So my question is quite simple : why ? And how to reach the Photo.app size ?

Thanks for your help :)

Upvotes: 1

Views: 248

Answers (1)

Stavash
Stavash

Reputation: 14304

As you probably know, the second parameter passed in UIImageJPEGRepresentation defines the compression quality (1 being the highest). Because the image is broken down back to basic data and then re-compressed (jpeg is a compressed image format), the result may be worse compression (larger file) and of course the image quality will not get any better. Try lowering the parameter to something in between 0.0 and 1.0 and see when you get the best match in file size (Will be unique for each image processed, so try and find a good value in the middle).

Upvotes: 1

Related Questions