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.


    Segmentation error with beta 340007 in ui.Image.from_data(...)

    Pythonista
    1
    1
    42
    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 cvp

      ui.Image.from_data(...) gives a segmentation error in

      	def pil2ui(self,imgIn):
      		with io.BytesIO() as bIO:
      			imgIn.save(bIO, 'PNG')
      			imgOut = ui.Image.from_data(bIO.getvalue())
      

      Or

      o = ObjCClass('UIImage').systemImageNamed_('arrow.up')#.chevron.compact.down')
      UIImagePNGRepresentation = c.UIImagePNGRepresentation
      UIImagePNGRepresentation.restype = c_void_p
      UIImagePNGRepresentation.argtypes = [c_void_p]
      UIImage_data = nsdata_to_bytes(ObjCInstance(UIImagePNGRepresentation(o)))
      ui_image = ui.Image.from_data(UIImage_data)
      

      Code is old and did work until new beta, 340006 and 340007

      Workaround

      			imgOut = ui.Image.named('iob:alert_32')
      			ObjCInstance(imgOut).initWithData_(bIO.getvalue())
      			#imgOut = ui.Image.from_data(bIO.getvalue())
      

      And

      ui_image = ui.Image.named('iob:alert_32')
      ObjCInstance(ui_image).initWithData_(UIImage_data)
      #ui_image = ui.Image.from_data(UIImage_data)
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Powered by NodeBB Forums | Contributors