Tk: bad output when converting image to PNG
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tk8.6 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Ubuntu 16.04 (amd64)
Tk 8.6.5 (tk8.6 8.6.5-1)
The PNG support in Tk causes bad PNG files to be written.
Note that the TkImg extension (libtk-img) is NOT what exhibits this issue.
This issue was noticed as part of a test suite for Tcl::pTk, a Perl Tcl/Tk wrapper: https:/
I ran a Lubuntu 16.04.6 amd64 live CD, installed tk8.6 8.6.5-1, and could reproduce the reporter's issue. Using a Tcl/Tk example, I confirmed the issue was in Tcl/Tk rather than the Perl wrapper. However, I could not reproduce this issue on 18.04 i386 (tk8.6 8.6.8-4) nor 19.04 amd64 (tk8.6 8.6.9-2), so I suspect this issue has been resolved by the newer upstream releases of Tk 8.6 in more recent Ubuntu versions.
It turns out that the release notes for Tcl/Tk 8.6.7 mention a "PNG writing" issue having been addressed: see https:/
Below is a test script to reproduce the issue (run using tclsh8.6 or wish8.6). Xcamel.gif can be obtained from https:/
package require Tk
# not doing `package require Img`--use PNG support included in Tk
image create photo icon -file "Xcamel.gif" -format gif
button .b -image icon
pack .b
icon write "Xcamel.png" -format png
# the following line will fail with "unfinalized data stream in PNG data"
image create photo icon2 -file "Xcamel.png" -format png
button .b2 -image icon2
pack .b2
I believe this bug can be closed since Ubuntu 16.04 is EOL.