Tk Source Code

View Ticket
Login
Ticket UUID: 95691a9eacc25dcf6f7937c01aebfdfd58e35783
Title: In the Widget tour, are 8MB images necessary?
Type: Bug Version: 8.7
Submitter: kjnash Created on: 2022-12-15 19:52:17
Subsystem: 76. Widget Tour Assigned To: marc_culler
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2022-12-21 15:58:42
Resolution: Fixed Closed By: marc_culler
    Closed on: 2022-12-21 15:58:42
Description:
The two Van Gogh images are very pleasing, but they are responsible for most of the increase in size of the Tk source tarball from 4.5MB (8.6.13) to 21.2MB (8.7a6).  There is a similar increase in the size of the zipped binary distribution of Tk.

Is it worth including such large files when they are not essential to Tk itself, and give the impression that Tk is over four times larger than it actually is?  I suggest replacing them with smaller files.

 8363308 library/demos/images/plowed_field.png
 8015314 library/demos/images/starry_night.png

 4546848 tk8.6.13-src.tar.gz
21278759 tk8.7a6-src.tar.gz
User Comments: jan.nijtmans added on 2022-12-20 16:24:52:

+1. Thanks for the fix!


marc_culler (claiming to be Marc Culler) added on 2022-12-19 19:29:20:
I guess it must be OK.  So I will merge the change.

marc_culler (claiming to be Marc Culler) added on 2022-12-17 15:48:22:
I decided to stick with .png, since that allows the full color palette
of the original images, but I reduced the size of each image to twice
the size at which it will be displayed in the demo.  (I did that to avoid
pixelation on retina screens).  This reduced the size of the image files
by a factor of 100, and looked OK to me.

Is this OK with everyone else?  (See branch bug-95691a9eac).

marc_culler added on 2022-12-16 18:15:55:
> A jpeg is not possible, since Tk doesn't have jpeg support by default

Hi Jan, that is not true.  The nsimage photo image type, now included in
Tk 8.7 for macOS, supports loading an image from a file of any format
supported by Apple's NSImage class.  That includes jpeg.

jan.nijtmans added on 2022-12-16 14:53:20:

A jpeg is not possible, since Tk doesn't have jpeg support by default


jan.nijtmans added on 2022-12-16 14:52:32:

Well, I don't have a tool at hand to reduce the size of a png, so I just tried "save as GIF" in paint. If you have a better idea, please go ahead!


marc_culler (claiming to be Marc Culler) added on 2022-12-16 14:37:55:
Sure, those images could be included as much smaller files without any
visual loss, since they are displayed at sizes much smaller than the image
size in the demo.  That means that the image object is doing the reduction
to the screen resolution.  That reduction could be done in advance. It is
nice to know that the image code handles such a reduction correctly but it
is not a requirement at all.

I don't think I would opt for using a GIF.  Is there some reason that you
wanted to do that, Jan, instead of just changing the size of the png to
match the size of the image that will be used in the demo, or use a jpeg?

jan.nijtmans added on 2022-12-16 11:44:31:

See [96e3244566621980|here] for possible fix. Most likely, can be reduced further without much visual loss.