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.


    Images not loading in ui.imageview()

    Pythonista
    2
    5
    5106
    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.
    • donnieh
      donnieh last edited by donnieh

      Loading an image from the local library works fine. See code below.

      ​
      import ui
      import Image
      sv = ui.ScrollView()
      sv.background_color = 'gray'
      iv = ui.ImageView()
      iv.image = ui.Image.named('Test_Bridge')
      sv.add_subview(iv)
      sv.present()
      
      

      But when I add my own image from the camera roll it does not work. What needs to be done to load a custom image?

      I open my photo album and copy the photo to clipboard using share menu. I then add the photo to Pythonista using the insert option. I can see it in the My Images category in Pythonista. It just wont load in for some reason.

      ​
      import ui
      import Image
      sv = ui.ScrollView()
      sv.background_color = 'gray'
      iv = ui.ImageView()
      iv.image = ui.Image.named('_Image_1') #does not work
      #iv.image = ui.Image.named('_Image_1.PNG') does not work
      #iv.image = ui.Image.named('_Image_1.png') does not work
      #iv.image = ui.Image.named('_Image_1.JPG') does not work
      #iv.image = ui.Image.named('_Image_1.jpg') does not work
      sv.add_subview(iv)
      sv.present()
      
      

      I am using Pythonista 1.5 on iOS9 - iPhone 6+

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

        Use http://omz-software.com/pythonista/docs/ios/photos.html to access the camera roll.

        1 Reply Last reply Reply Quote 1
        • donnieh
          donnieh last edited by

          I may not have spoken clearly. The goal here is to put a custom image in an imageview(). The camera roll is just a place where I am getting my images from to put into pythonista.

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

            See image_file.py at https://github.com/cclauss/Ten-lines-or-less

            1 Reply Last reply Reply Quote 1
            • donnieh
              donnieh last edited by

              Thank you @ccc

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