Re: Format of tkIcons.* contents ?

Dean Arnold <[email protected]> Wed, 16 Aug 2006 09:27:03 -0700
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Ala Qumsieh wrote:
> 
> The images are in Base64-encoded GIF format.
> I got them from here:
> 
> http://www.satisoft.com/tcltk/icons/libraries.html
> 
> --Ala
> 

Many thanks. If anyone's interested, my script
to convert them into the original GIFs is provided below.

Dean Arnold
Presicient Corp.


# assumes the tk icon files are in ./srcicons,
# and writes the images out to
# ./icons/<srcfilename>/<imagename>.gif

use MIME::Base64;

use strict;
use warnings;

foreach my $file (@ARGV) {
	unless (-e "./icons/$file") {
		mkdir "./icons/$file" or die "Can't create ./icons/$file\n";
	}
	die "Can't open $file:$!"
		unless open(INF, "srcicons/$file");
	print " *** Starting $file...\n";
	while (<INF>) {
		my @items = split /[\s:]/;
		my $name = shift @items;
		my $src = pop @items;
		my $gif = decode_base64($src);
		warn "Can't open $name.gif: $!" and next
			unless open(OUTF, ">./icons/$file/$name.gif");
		binmode OUTF;
		print "\t*** $name.gif\n";
		print OUTF $gif;
		close OUTF;
	}

	close INF;
}
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk