omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Multi-frame GIFs to clipboard or photos

    Pythonista
    5
    17
    12132
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mmontague
      mmontague @JonB last edited by

      @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.

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • Webmaster4o
          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.

          mmontague 1 Reply Last reply Reply Quote 0
          • Gerzer
            Gerzer last edited by Gerzer

            Do you have the app Workflow by DeskConnect? Also, how many frames are in the GIF?

            mmontague 1 Reply Last reply Reply Quote 0
            • mmontague
              mmontague @Gerzer last edited by

              @Gerzer I do not have Workflow. Number of Frames can be anywhere between 4 and 12 or so.

              1 Reply Last reply Reply Quote 0
              • mmontague
                mmontague @Webmaster4o 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.

                1 Reply Last reply Reply Quote 0
                • Gerzer
                  Gerzer last edited by

                  Then the solution I had in mind won't work. Oh, well. I'll keep thinking. :)

                  1 Reply Last reply Reply Quote 0
                  • Gerzer
                    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.

                    1 Reply Last reply Reply Quote 0
                    • JonB
                      JonB last edited by

                      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 close before displaying the mail controller. you could edit the callback to display it again after dismissing the mail sheet.

                      mmontague 1 Reply Last reply Reply Quote 1
                      • mmontague
                        mmontague @JonB last edited by

                        @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!

                        1 Reply Last reply Reply Quote 0
                        • mmontague
                          mmontague last edited by

                          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'))
                          
                          
                          1 Reply Last reply Reply Quote 0
                          • omz
                            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.

                            1 Reply Last reply Reply Quote 0
                            • mmontague
                              mmontague last edited by

                              It works! Awesome, thanks!

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              Powered by NodeBB Forums | Contributors