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 are not resizing, being saved in original size.

    Pythonista
    3
    5
    2994
    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.
    • alpinerunner
      alpinerunner last edited by

      I'm trying to take the newest image from my photo album and resize it to 120x120.

      Here is my code.

      import photos as p
      import PIL as y

      x = p.get_count()
      img = p.get_image(x-1)

      thmb = img.resize((120,120))
      thmb.show()

      rslt = p.save_image(thmb)
      print rslt

      The image is saved back to my photo album, but when I look in the photo album directly from the iphone, the image maintains its original size.

      When I run the following script a second time, it should load the 120x120 resized image. Here's the crazy part. When I print the dimensions of that image, it's 120x120, even though it's 817x817 in my iOS photo album.

      What am I missing here?

      Thanks.

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

        Let me try some better line breaks:

        import photos as p
        import PIL as y
        x = p.get_count()
        img = p.get_image(x-1)
        thmb = img.resize((120,120))
        thmb.show()
        rslt = p.save_image(thmb)
        print rslt
        
        1 Reply Last reply Reply Quote 0
        • omz
          omz last edited by

          Are you sure this is the exact code you're using? It works fine for me. A common mistake would be to use p.save_image(img) instead of p.save_image(thmb), but that doesn't seem to be the case here.

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

            Agreed. For me, the above script works as expected on both iPhone and iPad.

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

              I figured out my problem. 817 x 817 meant it was the 817th photo out of an album of 817. The images were in fact being saved to the correct size.

              Live and learn.
              Sorry guys.

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