Non-square icon displays garbled image
Affected version
Provide at least the following information:
- Your OS and version: Fedora Linux 38
- Affected GNOME Shell version: 44.4
- Does this issue appear in XOrg and/or Wayland: XOrg only (you can't change an icon with Wayland)
- Does this issue happen without extensions: yes
Bug summary
When setting a non-square icon, garbled data is shown.
Steps to reproduce
- Save the python script below as e.g.
/tmp/non-square-icon.py
, and run it aspython /tmp/non-square-icon.py
. - Look at the icon in the task bar
#!/usr/bin/env python
from tkinter import *
from tkinter.ttk import *
import tkinter as tk
# magick -size 64x40 canvas:khaki out.png
PNG_DATA = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00@\x00\x00\x00(\x01\x03\x00\x00\x00t\x00n\xaa\x00\x00\x00 cHRM\x00\x00z&\x00\x00\x80\x84\x00\x00\xfa\x00\x00\x00\x80\xe8\x00\x00u0\x00\x00\xea`\x00\x00:\x98\x00\x00\x17p\x9c\xbaQ<\x00\x00\x00\x06PLTE\xf0\xe6\x8c\xff\xff\xff\xb0P\xbd8\x00\x00\x00\x01bKGD\x01\xff\x02-\xde\x00\x00\x00\x07tIME\x07\xe7\t\x01\x0b\x18$\xc0t\x17\xe7\x00\x00\x00\rIDAT\x18\xd3c`\x18\x05\xf4\x00\x00\x01h\x00\x01\xd9\xb6\x15\xb4\x00\x00\x00%tEXtdate:create\x002023-09-01T11:24:36+00:00\xb9\x8e\xd4o\x00\x00\x00%tEXtdate:modify\x002023-09-01T11:24:36+00:00\xc8\xd3l\xd3\x00\x00\x00(tEXtdate:timestamp\x002023-09-01T11:24:36+00:00\x9f\xc6M\x0c\x00\x00\x00\x00IEND\xaeB`\x82'
with open("/tmp/a.png", "wb") as f:
f.write(PNG_DATA)
program = Tk()
p1 = PhotoImage(file="/tmp/a.png")
program.iconphoto(False, p1)
b = Button(program, text='Press Me!')
b.pack(side=TOP)
program.title('iconphoto() method')
mainloop()
What happened
The icon shows up garbled, containing what appears to be binary data.
What did you expect to happen
The icon, without garbled data.
Relevant logs, screenshots, screencasts etc.
This "effect" reproduces with python tk, SDL and glfw3.