Skip to content
Permalink
Browse files

Merge pull request #1673 from PySimpleGUI/Dev-latest

Changed how image is created before updating the Image Element. Now i…
  • Loading branch information...
MikeTheWatchGuy committed Jul 9, 2019
2 parents decb5c5 + 462a4f4 commit 294102b36082044a16320c90484b0d014fb94ae6
Showing with 6 additions and 0 deletions.
  1. +6 −0 DemoPrograms/Demo_OpenCV.py
@@ -57,10 +57,16 @@ def main():
slider_elem.Update(cur_frame)
cur_frame += 1

imgbytes = cv.imencode('.png', frame)[1].tobytes() # ditto
image_elem.Update(data=imgbytes)

"""
# This was another way updates were being done, but seems slower than the above
img = Image.fromarray(frame) # create PIL image from frame
bio = io.BytesIO() # a binary memory resident stream
img.save(bio, format= 'PNG') # save image as png to it
imgbytes = bio.getvalue() # this can be used by OpenCV hopefully
image_elem.Update(data=imgbytes)
"""

main()

0 comments on commit 294102b

Please sign in to comment.
You can’t perform that action at this time.