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.


    New iPad PIL Image import problem

    Pythonista
    3
    8
    5132
    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.
    • Morgan
      Morgan last edited by

      Hi Guys,
      I wrote a Pythonista program for iPad about 3 years ago which imports PIL images which will now not work. My code:

      from PIL import Image
      im = Image.open('_Image_1')
      im.show()

      Returns an error:

      IOError[Erno2]no such file or directory:'Image'

      This a new problem. My image file is still there with all of the images.

      Can any of you guys tell me what changed and how do I fix it?

      Thanks and take care,
      Morgan

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

        Could you try either Image.open('Images/_Image_1.png') or Image.open('_Image_1.png')?

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

          HI Guys,
          Thank you, your first solution fixed the problem but the second did not. Also, for anyone else with this problem you must use the full name of the Image with the png suffix in the parentheses when you use the im.show () command so that my old code:

          from PIL import Image
          im = Image.open('_Image_1')
          im.show()

          Becomes:

          from PIL import Image
          im = Image.open('Images/_Image_1.png')
          im.show('_Image_1.png')

          Thank you for this great help but I am still curious as to what changed in the last 3 years?

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

            @Morgan A very long time ago, Pythonista didn't support folders. When you added an image from the clipboard, it would end up in a hidden "Images" folder, and Image.open() would just assume that any image without file extension was in that folder... I've since improved Pythonista's file management capabilities, and the old behavior seemed a little too non-standard.

            1 Reply Last reply Reply Quote 2
            • Morgan
              Morgan last edited by

              Hi Guys,
              OK, now I have a new problem. My images will open in the console but only as thumbnails where before they were full size. So how do I fix this? Also, are my old images now automatically placed in a new folder called "Images" and where this folder name come from?
              Thanks,
              Morgan.

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

                @Morgan When you open an image file from the library (I assume that's what you mean), you can view them in full size by tapping "Quick Look". The console (e.g. when you use image.show() may scale images down a bit, but they shouldn't really be thumbnails.

                The "Images" folder was probably created by an older version of Pythonista. In the current version, you can put images in any folder you like.

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

                  Hi Guys,
                  Where is "Quick Look"?
                  Morgan.

                  Phuket2 1 Reply Last reply Reply Quote 0
                  • Phuket2
                    Phuket2 @Morgan last edited by

                    @Morgan , you can use console.quicklook(file_path), or if you select a file Pythonista can't display, it shows a icon in the middle of the screen with a button under it to quicklook

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