Tk Library Source Code

View Ticket
Login
Ticket UUID: e7f1ed859e9ba6b2317af2736634e935a91ecf1c
Title: The ICO package does not handle 256x256 icons properly
Type: Bug Version: 0.7
Submitter: drlabelle Created on: 2020-09-12 23:44:15
Subsystem: tklib :: ico Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2026-11-15 23:40:01
Resolution: None Closed By: nobody
    Closed on:
Description:
The ::ico::getIconMembersICO procedure returns a value of 0 for both the width and height of 256x256 icons. Zero is the stored value for this size icon but the value should be interpreted to mean a value of 256.

The procedure can be corrected by replacing the following line in the ::ico::getIconMembersICO procedure
	    lappend info [scan [read $fh 1] %c] [scan [read $fh 1] %c]
with
	    set width [scan [read $fh 1] %c]
	    set height [scan [read $fh 1] %c]
	    if {$width == 0} { set width 256}
	    if {$height == 0} { set height 256 }
	    lappend info $width $height
User Comments: serhiy.storchaka added on 2026-11-15 23:40:01:

Proposed fix in branch ico-256-icons.

As suggested, a width or height of 0 in the icon directory is now read as 256. In addition, the reader for icon data no longer returns negative sizes for icons from 128 to 255 pixels.