Multi-frame GIFs to clipboard or photos
have you tried emailing a gif that you have in the camera roll? The stock photos app does not show animated gifs, but if you mail it, the email app shows the animation (you do not have to send the email, just click the share by email button to bring up the message)
Where are you trying to get the image, eventually? There may (or may not) be an easier way than through the camera roll.
omz last edited by
photosmodule doesn't support this. It may be possible using native APIs (
objc_util) if you have the beta, I haven't tried this yet.
What I am trying to do is put the GIFs that I've created in Pythonista (using the images2gif module) into an email or text message. The clipboard and the camera roll are the two ways I can think of to do this.
I know I stop my Pythonista script, use the Pythonista IDE's file browser and select and view the GIF, copy it, and then paste it into text/email. But I would rather be able to do the copy/paste operation from Pythonista to text/email without stopping my Pythonista script.
Is there another way?
@JonB I did try emailing and texting the file that gets saved to camera roll using photo.set_image(). Turns out it is a jpeg and it only has the initial frame.
One option: use console.quicklook to automatically display the image. Then , use the share button to share to email or imessage.
(might only work with the beta, quicklook and sharing worked differently in 1.5, but I am not sure)
Another option: serve up html, and open using safari, which should let you save to photos. The first open will be somewhat less intrusive.
Webmaster4o last edited by
If you open the gif in the editor, long press on it, and press save image using the native iOS dialog, you can save the whole gif. Save it the same way you would from safari if you saw it online.
Another solution is using an API like pyimgur to upload your GIF to the internet. Then, paste the link into your browser and save it from there.
Gerzer last edited by Gerzer
Do you have the app Workflow by DeskConnect? Also, how many frames are in the GIF?
@Gerzer I do not have Workflow. Number of Frames can be anywhere between 4 and 12 or so.
mmontague last edited by mmontague
@Webmaster4o Thanks for the tips. I can do your first one, but getting back to the editor involves closing the app -- so not quite ideal. Your second idea is interestings... I will look into that.
Gerzer last edited by
Then the solution I had in mind won't work. Oh, well. I'll keep thinking. :)
Gerzer last edited by Gerzer
It would work if you'd be willing to put down some money for Workflow. It's a great app and is quite useful for Pythonista users. I'm not trying to pressure you into buying it, though. Do so only if you want to.
Here is a fully functional implementation of MFMailComposeView which lets you precompose an email, and attach a file. Any file type is allowed, although you will need to know the proper mime type name, such as image/gif, or application/zip for emailing zip files, etc. The user chooses to send or cancel from the ios mail composer.
The example main() shows also how this would work if launching from a ui-- you need to use
closebefore displaying the mail controller. you could edit the callback to display it again after dismissing the mail sheet.
@JonB Yes, this looks like an awesome solution. I see it uses the objc_util so I think that means I would need the beta, or else wait for the next release. But I think something like this is the long-term solution. Appreciate it!
Using objc_util, which I really don't understand well at all, and working off examples I've found here and there on this forum, I feel like I almost have it.... just trying to put an animated GIF onto the clipboard so it can be pasted into another app.
Method 1 below (commented out) works, but when the image is pasted it is unfortunately a .PNG.
Method 2 allows you to specify image type. However, this does not seem to work at all. Clipboard is empty.
# coding: utf-8 from objc_util import * UIPasteboard=ObjCClass('UIPasteboard') pb=UIPasteboard.generalPasteboard() #method 1: works but creates a .png: #imgdata = UIImage.imageWithContentsOfFile_('test.gif') #pb.setImage_(imgdata) # method 2: does not work. pasteboard is empty imgdata = NSData.dataWithContentsOfFile_('test.gif') pb.setData_forPasteboardType_(imgdata, ns('kUTTypeGIF'))
omz last edited by omz
Method 2 should work if you use
'com.compuserve.gif'(the UTI for GIF images) instead of
'kUTTypeGIF'. The latter is the name of a constant/macro, it would get replaced by the preprocessor if you were writing actual Objective-C code.
I've tested this with an animated GIF, and was able to paste it in an email.
It works! Awesome, thanks!