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.


    Use of my own pictures/images

    Pythonista
    4
    5
    2090
    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.
    • guran
      guran last edited by

      Just got started with pythonista and I have succeeded in writing a script that presents an image from the examples found in pythonista, but instead I want to use one of my own pictures but fails to import it into pythonista. Have saved an image from photos to the folder app on the iPad but the image file is grayed out when I try to open it as an external file from pythonista.

      Have also tried to share the image directly from photos, selecting the option ”run pythonista script" but gets no option to import any file so I do not understand how to do.

      Can someone please help me move forward?

      1 Reply Last reply Reply Quote 0
      • sam rod
        sam rod last edited by ccc

        a néxt script is for move a copy.

        from PIL import Image
        import appex
        import ui
        
        def main():
        	if not appex.is_running_extension():
        		print('This script is intended to be/ run from the sharing extension.')
        		return
        	img = appex.get_image()
        	path=appex.get_file_path()
        	if not img:
        		print('No input image')
        		return
        	if not img.mode.startswith('RGB'):
        		img = img.convert('RGB')
        	#print(path) use to know if the image has a direccion, do not
        	#print(img)
        	#print(str(img.format).lower()) is format, in case a .PNG appears
        	#b=img.tobytes() a try
        	img.save('hulk.'+str(img.format).lower()) # is sace in join to the script
        	img.show() # just to simplified
          
        if __name__ == '__main__':
        	main()
        

        next u can upload the file to Google and remove it

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

          import photos
          pil_image = photos.pick_asset(assets=photos.get_assets()).get_image()
          
          1 Reply Last reply Reply Quote 0
          • cvp
            cvp last edited by

            And, if you really want a copy, in the Pythonista files browser:

            • bottom left, + button
            • import...
            • photo library
            1 Reply Last reply Reply Quote 2
            • guran
              guran last edited by

              Thank you so much for your help ... now I have managed to move on

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