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.


    Access image file from ios share sheet to get file size (and possibly change it)

    Pythonista
    2
    2
    1406
    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.
    • ChrisHare
      ChrisHare last edited by

      So - I am new to Pythonista and running python on iOS, so this may have been solved by someone already.

      What I want to do is be able to select one or more image files from the Files.app, and run my Pythonista script from the share sheet. The Pythonista app will get the image dimensions (width x height) and print the results.

      Ideally, being able to provide the desired dimensions as either both width and height, or if only value is provided, adjust the other by the same percentage.

      What is the best approach to this?

      Thanks

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @ChrisHare last edited by

        @ChrisHare this script does exactly what you want

        import appex
        ui_image = appex.get_image(image_type='ui')
        print(ui_image.size)
        

        In Photos, you

        • select one
        • tap share button
        • tap "run Pythonista script"
        • tap "edit scripts"
        • choose this script
        • tap the run button

        Of course, if you want to use frequently, you can add it to the Pythonista share scripts

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