vitalyster / tclkit

Automatically exported from code.google.com/p/tclkit
0 stars 0 forks source link

Tclkit should include a script to convert PNGs to Tclkit-parsable ICOs #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Here's a sample makefile:
all:
    @echo "Nothing to do."

hb.png: hb.xcf
    xcf2png hb.xcf

hb-%x8.png: hb.png
    @echo convert "$^" -colors 255 `echo "$@" | sed
's@^.*-\([0-9]*x[0-9]*\)x\([0-9]\).png@ -resize \1 -depth \2@'`  $@; \
    convert "$^" -colors 255 `echo "$@" | sed
's@^.*-\([0-9]*x[0-9]*\)x\([0-9]\).png@ -resize \1 -depth \2@'`  $@

hb-%x4.png: hb.png
    @echo convert "$^" -colors 15 `echo "$@" | sed
's@^.*-\([0-9]*x[0-9]*\)x\([0-9]\).png@ -resize \1 -depth \2@'`  $@; \
    convert "$^" -colors 15 `echo "$@" | sed
's@^.*-\([0-9]*x[0-9]*\)x\([0-9]\).png@ -resize \1 -depth \2@'`  $@

%.png.pgm: %.png
    pngtopnm -alpha "$^" > "$@"

%x4.png.ppm: %x4.png
    pngtopnm "$^" | ppmquant 15 > "$@"

%x8.png.ppm: %x8.png
    pngtopnm "$^" | ppmquant 255 > "$@"

%.png.ico: %.png.ppm %.png.pgm
    ppmtowinicon -andpgms -output "$@" $^

hb.ico: hb-16x16x4.png.ppm hb-16x16x4.png.pgm hb-16x16x8.png.ppm
hb-16x16x8.png.pgm hb-32x32x4.png.ppm hb-32x32x4.png.pgm hb-32x32x8.png.ppm
hb-32x32x8.png.pgm hb-48x48x4.png.ppm hb-48x48x4.png.pgm hb-48x48x8.png.ppm
hb-48x48x8.png.pgm
    ppmtowinicon -andpgms -output "$@" $^

clean:
    rm -f *.png.ico *.png.ppm *.png.pgm hb.ico hb-*.png hb.png

.PHONY: clean all

Original issue reported on code.google.com by goo...@rkeene.org on 26 Mar 2009 at 2:30

GoogleCodeExporter commented 8 years ago
This is what I (Vaclav Hanzl) use in Makefile:

# Create icon with all 6 variants needed for equi4 exe.
# Input .png can be 48x48 or more, e.g. 96==lcm(16,32,48)
# (needs Debian packages icoutils and imagemagick)

.PRECIOUS: %.ico

%.ico: %.png
    convert -geometry 16x16 -colors  16 $< $*-0.png
    convert -geometry 16x16 -colors 256 $< $*-1.png
    convert -geometry 32x32 -colors  16 $< $*-2.png
    convert -geometry 32x32 -colors 256 $< $*-3.png
    convert -geometry 48x48 -colors  16 $< $*-4.png
    convert -geometry 48x48 -colors 256 $< $*-5.png
    icotool -c -o $@ $*-[0-5].png
    rm $*-[0-5].png

Original comment by vha...@gmail.com on 25 Nov 2010 at 11:42