I've got a UIImagePickerController
letting the user pick an image out of the image library, and am getting its results via the didFinishPickingMediaWithInfo
method.
I need to be able to save the resulting image to disk (in the app's documents folder), and reload it later.
The issue is that I can't tell whether to store it as a PNG or JPEG. I can't just always store it as a PNG, because for larger photos it's interminably slow (not to mention then I have to deal with storing the image orientation separately). I can't just always store it as a JPEG, because in some cases the images have transparency, which will get lost if I do that.
I've examined the UIImagePickerControllerMediaType
key in the info dictionary returned by the image picker, and regardless of whether I've selected a PNG or JPEG, what gets returned is "image.public"
.
So...
Is there some way to know whether the user has chosen a PNG? Maybe some method of just checking if the image has any transparency or something?
Thanks.