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.


    How to debug crash of image script when it's called as extension

    Pythonista
    4
    29
    7017
    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.
    • cvp
      cvp last edited by

      Correction: appex does not have a get_ui_image

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

        We mixed with asset.get_ui_image

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

          I have been disturbed only because the post comes from @JonB

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

            @halloleooo doc dixit, you could try with

            img = appex.get_image(image_type='ui')
            
            #files = appex.get_attachments()
            #for f in files:
            files = appex.get_images(image_type='ui')
            for ui_image in files:
            	#pil = Image.open(f)#,mode='r')
            	#ui_image = pil2ui(pil)
            	#del pil
            
            1 Reply Last reply Reply Quote 0
            • halloleooo
              halloleooo last edited by ccc

              I think the Pyhonista docs mentions appex.get_ui_image(). Is this wrong?

              cvp 5 Replies Last reply Reply Quote 0
              • cvp
                cvp @halloleooo last edited by

                @halloleooo modif just above also crashes with two big photos...

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

                  @halloleooo said:

                  I think the Pyhonista doco mentions appex.get_ui_image(). Is this wrong?

                  The internal doc, reached via help, and the source of appex.py do not mention it

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

                    @halloleooo but, as I said previously, asset.get_ui_image exists

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

                      @halloleooo print dir(appex) to confirm

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

                        @halloleooo I said"modif just above also crashes with two big photos..." but with pil it works

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

                          @halloleooo ok, now, Forget all, this works, by commenting the del ui_image
                          and is quicker than converting pil
                          even with wi=1000 with two photos of 2600x4000 pixels

                          # assume two images are shared
                          #files = appex.get_attachments()
                          #for f in files:
                          files = appex.get_images(image_type='ui')
                          for ui_image in files:
                          	#pil = Image.open(f)#,mode='r')
                          	#ui_image = pil2ui(pil)
                          	#del pil
                          	w,h = ui_image.size
                          	wi = 400
                          	hi = wi*h/w
                          	with ui.ImageContext(wi,hi) as ctx:
                          		ui_image.draw(0,0,wi,hi)
                          		#del ui_image
                          		ui_resize = ctx.get_image()
                          		ui_images.append(ui_resize)
                          		del ui_resize		
                          
                          1 Reply Last reply Reply Quote 0
                          • JonB
                            JonB last edited by

                            @cvp, sorry, I did not actually try it -- per the release notes there is supposed to be appex.get_ui.image().

                            didn't actually look -- but

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