Tk: bad output when converting image to PNG

Bug #1834314 reported by Christopher A. Chavez
6
This bug affects 1 person
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://rt.cpan.org/Ticket/Display.html?id=128803

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://sourceforge.net/projects/tcl/files/Tcl/8.6.7/tcltk-release-notes-8.6.7.txt/view . I believe this is the corresponding upstream Tk ticket: https://core.tcl-lang.org/tk/tktview/10f2e7872b . That issue turned out to be caused Tcl, rather than Tk; ticket: https://core.tcl-lang.org/tcl/tktview/b26e38a3e4 , check-in: https://core.tcl-lang.org/tcl/info/e5b3cf7279 . Even if this is indeed the issue I've observed, I am not sure if it is practical to patch this issue, or to backport a later Tcl/Tk release to 16.04.

Below is a test script to reproduce the issue (run using tclsh8.6 or wish8.6). Xcamel.gif can be obtained from https://github.com/eserte/perl-tk/raw/master/Tk/Xcamel.gif or likely can be substituted.

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

Revision history for this message
Christopher A. Chavez (chrstphrchvz) wrote :

I believe this bug can be closed since Ubuntu 16.04 is EOL.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.