Search code examples
objective-cios6uiimageuiactivityviewcontrolleruiactivity

Is there a way to specify the image format when using UIActivityViewController on a UIImage?


It seems that the OS chooses whether to use a PNG or JPEG for reasons unknown. In my case, I want a JPEG sent (via mail, twitter, etc.) but I tend to get a very large PNG.

If I subclass UIActivityItemProvider and return an NSURL pointing to a file that I created myself by writing a JPEG to disk using UIImageJPEGRepresentation, I can of course get a JPEG. However using an NSURL causes other issues (one of them being the inability to use iMessage as a target). Is there any way to use a UIImage, but specify that you would prefer a certain file format? (I'm quite sure the answer is NO, but want to check.)


Solution

  • Looks like the answer is indeed NO.