buildset.py (Python iconset builder)

Various Stuff

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

0
Score 50.0%
Description:

This is mainly for iconset authors, but users may also want to use this to build iconsets more efficiently.

I grew impatient with the Bash scripts that are often included with iconsets here at kde-look. I also happen to be learning Python so I took a stab at writing a buildscript in Python for fun and to see if there would be any differences between Bash/convert and Python/PIL. This is what I found on my machine (1.7G Pentium 4, 512 RAM) using 3 different iconsets:

Dark-Glass:
http://www.kde-look.org/content/show.php/Dark-Glass+reviewed?content=67902

buildscript.py:
5m17s
66M Dark-Glass-2.4.tar.bz2
98M Dark-Glass - uncompressed

buildscript.sh:
18m47s
125M Dark-Glass.tar.bz2
165M Dark-Glass - uncompressed

Leopard-Style:
http://www.kde-look.org/content/show.php/Leopard-Style?content=71732

buildscript.py:
1m9s
12M Leopard-Style-0.4.tar.bz2
22M Leopard-Style - uncompressed

buildscript.sh:
4m34s
24M Leopard-Style.tar.bz2
38M Leopard-Style - uncompressed

Breathless:
http://www.kde-look.org/content/show.php/Breathless?content=60465

buildscript.py:
11m21s
135M Breathless-1.1.tar.bz2
204M Breathless-1.1 - uncompressed

buildscript.sh:
33m42s
268M Breathless.tar.gz - included script used gzip instead of bzip2
336M Breathless - uncompressed

One main difference between buildscript.py and buildscript.sh is that buildscript.sh uses convert from ImageMagick which when resizing 8-bit icons it converts the icons to 16-bit. This increases the time in conversion and space in storage, but there are no gains because you can't get any more information from 8-bit to 16-bit conversion. I carefully looked at the icons and I see no difference between them. The 16-bit conversion would only be valuable in converting from higher bit or raw images, not lower bit images.

Please give this script a try and please tell me if I am wrong.

REQUIRED:

Python-2.5.1
Python Imaging Library-1.1.6
Versions are only tested versions, other versions may or may not work.

ImageMagick's convert for the odd .xpm file.
Last changelog:

11 years ago

0.3:
Fixed a few errors and tidied up the code.

0.2:
A little more intelligent, thus a little more flexible. It'll play nice with more iconsets out there, including any that have unusual directories within 128x128 or 32x32 directories, i.e., categories, emblems, emotes, etc. The variables in the script are dynamic rather than static as they were before.

Converts .xpm files to .png prior to resizing because PIL can't handle them, .xpm files are left intact, however.

Added some error reporting, including a text file listing, if any, icons that failed to resize for whatever reason.

Gives user the option of resizing actions icons to 32x32 and smaller in the interest of saving space and faster building.

Disregards hidden files now, i.e., '.dolphinview' and '.DS_Store'.

mentalrey

11 years ago

Many many TKS for the script , you are a genius.
Prox release of Dark-Glass implement it.

p.s.
i know to do a script like a fish know to do equations (anyone have is job) ;-)

Report

C

LocoMojo

11 years ago

Cheers Mentalrey, glad you found it useful.

It's the least I can do in return for your awesome iconset! I only wish I could do more.

LocoMojo

Report

C

LocoMojo

11 years ago

...sorry about the double post.

LocoMojo

Report

sceazy

11 years ago

Very nice, it seems to produce much clearer icons at at smaller sizes, good job.

Report

C

LocoMojo

11 years ago

Thanks.

I can especially see some faster degradation in the 16-bit icons converted from 8-bit than the 8-bit to 8-bit icons when I enlarge them to get a closer look so there are definitely some differences.

This script provides faster building, less space used in storage, and less degradation in the icons. I only did this for fun and I was pleasantly surprised at the result.

Hope someone out there finds this script useful.

Cheers,
LocoMojo

Report

C

LocoMojo

11 years ago

Thanks.

I can especially see some faster degradation in the 16-bit icons converted from 8-bit than the 8-bit to 8-bit icons so there is definitely some differences.

This script provides faster building, less space used in storage, and less degradation in the icons. I only did this for fun and I was pleasantly surprised at the result.

Hope someone out there finds this script useful.

Cheers,
LocoMojo

Report

11 years ago

0.3:
Fixed a few errors and tidied up the code.

0.2:
A little more intelligent, thus a little more flexible. It'll play nice with more iconsets out there, including any that have unusual directories within 128x128 or 32x32 directories, i.e., categories, emblems, emotes, etc. The variables in the script are dynamic rather than static as they were before.

Converts .xpm files to .png prior to resizing because PIL can't handle them, .xpm files are left intact, however.

Added some error reporting, including a text file listing, if any, icons that failed to resize for whatever reason.

Gives user the option of resizing actions icons to 32x32 and smaller in the interest of saving space and faster building.

Disregards hidden files now, i.e., '.dolphinview' and '.DS_Store'.

12345678910
product-maker Count: 4 Rating: 5.0
File (click to download) Version Description Downloads Date Filesize DL OCS-Install
Pling
*Needs ocs-url or ocs-store to install things
Details
license
version
0.3
updated Feb 10 2008
added Jan 03 2008
downloads 24h
0
page views 24h 1