appJar
appJar copied to clipboard
Can't use addImageData with PIL Image
Bug Report
Context
Trying to load a PIL Image
Expected Behaviour
image is displayed
Actual Behaviour
error is thrown
Any error messages produced by appJar
File "//nas1.per.fhc.zone/daniel/dev/EZPotion/EZPotion.py", line 42, in
Sample code, demonstrating the issue
someGUIObject.addImageData("title", somePILImage, fmt=None)
What steps are needed to reproduce the bug
Try to add a PIL Image using addImageData()
Version Information
appJar: 0.93.0 Python: 3.7.2 TCL: 8.6, TK: 8.6 Platform: Windows pid: 6496 locale: en_AU
How are you making the image?
According to StackOverflow, that type of error is raised when you don't create the image correctly, they recommend using:
im = Image.open(pathToImage)
ph = ImageTk.PhotoImage(im)
Then you pass ph
I'm just creating an Image object not a PhotoImage objectOn 24 Mar. 2019 14:57, Richard Jarvis [email protected] wrote:How are you making the image? According to StackOverflow, that type of error is raised when you don't create the image correctly, they recommend using: im = Image.open(pathToImage) ph = ImageTk.PhotoImage(I'm)
Then you pass ph
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.
I'm looking for the supported image formats for appJar, so far the only formats I've found besides the standard file extensions is the "PhotoImage" format, so maybe you have to convert it into that format before you display it. Which is kinda silly, but I don't know what else to do.
EDIT:
im = Image.open(pathToImage)
ph = ImageTk.PhotoImage(im)
Did not work.
What I ended up doing was essentially loading the image twice, once with Image.open(filepath)
to be able to have a file object to correctly save transparent PNGs with. The next line is PhotoImage(file=filepath)
in order to have a file to correctly output to appJar. I now have two dictionaries housing two identical copies of every image I intend to do this with... which is not ideal.
but appJar can't show PIL images, and Tkinter Images can't seem to save in the PNG format correctly.