[Bug 1834314] [NEW] Tk: bad output when converting image to PNG
Christopher A. Chavez
chrischavez at gmx.us
Wed Jun 26 09:54:44 UTC 2019
Public bug reported:
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
** Affects: tk8.6 (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to tk8.6 in Ubuntu.
https://bugs.launchpad.net/bugs/1834314
Title:
Tk: bad output when converting image to PNG
Status in tk8.6 package in Ubuntu:
New
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
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tk8.6/+bug/1834314/+subscriptions
More information about the foundations-bugs
mailing list