Looks like the answer is indeed NO.
Is there a way to specify the image format when using UIActivityViewController on a UIImage?
-
15-01-2022 - |
Question
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 2
OTHER TIPS
Actually it just worked to pass in the NSData
of the JPEG representation as the activity item.
NSData *data = UIImageJPEGRepresentation(image, 0.6);
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:@[data]];
applicationActivities:nil];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow