Hallo! Hier ein kleiner Nachtrag zum beschriebenen Verfahren mit dem Programm 'ppmtowinico'. Ich wandle ein Bild in PPM-Bilder um und speichere diese (mit Hilfe von 'ppmtowinico') in einer neuen ICO-Datei. Zum Konvertieren verwende ich 'convert' (im Paket ImageMagick), man kann aber auch andere Programme verwenden (wie bereits erwähnt: ppmquant und andere Tools aus netpbm). - Matthias - ------- Hier für das Listen-Archiv das komplette Script von mir: <script name="imagetoico.pl"> #!/usr/bin/perl # ^^^^^^^^^ maybe change your path here! # # Wrapper to convert an image to Windows-ICO-File # Uses: 'convert' (ImageMagick) and 'ppmtowinico' (netpbm) # # Written by Matthias Voss - linux(at)matthias-voss.de # Open-Source Community Software # Written 03. Feb 2003 # Last Change 19. May 2003 # # Referring to Microsofts recommendation (see ppmtowinico man page): # Create three images # 16 x 16 - 4 bpp # 32 x 32 - 4 bpp # 48 x 48 - 8 bpp # and make a new Win-ICO-image from use strict; my $inputfile = shift; # image to convert my $outputfile = shift; # converted Win-ICO image my $tmpdir = shift || "/tmp"; # directory used for temporary files my $tmpfile = "tmpimage"; # temporary created image name part my $convert = "convert"; # program: convert inputfile to # resized PPM images my $ppmtowinicon = "ppmtowinicon"; # program: convert PPM to # Win-ICO images # Temporary created PPM images referring to Microsofts recommendation my $ppm16 = "$tmpdir/$tmpfile.16x16.4bpp.ppm"; my $ppm32 = "$tmpdir/$tmpfile.32x32.4bpp.ppm"; my $ppm48 = "$tmpdir/$tmpfile.48x48.8bpp.ppm"; if (not defined($inputfile)) { # is an inputfile given? $0 =~ /.*\/(.*)/g; print "Convert an Image to an Windows-Ico-File\n\n"; print "usage: $1 inputfile [outputfile] [tmpdir]\n\n"; exit; } if (not defined($outputfile)) { # is an outputfile given? $inputfile =~ /(.*)\..*/g; $outputfile = $1.".ico"; } # create temporary ppm-files image_convert("16", "16x16",$inputfile,$ppm16); image_convert("16", "32x32",$inputfile,$ppm32); image_convert("256","48x48",$inputfile,$ppm48); # create final image print "* Create Ico-File: $ppmtowinicon $ppm16 $ppm32 $ppm48 > $outputfile\n\n"; system "$ppmtowinicon $ppm16 $ppm32 $ppm48 > $outputfile"; print "Done. Your new Win-Ico-File is now: $outputfile\n"; # and clean tmpdir system "unlink $ppm16"; system "unlink $ppm32"; system "unlink $ppm48"; sub image_convert { my ($colors, $size, $inputfile, $outputfile) = @_; print "* Resize Image: $convert -colors $colors -resize $size! $inputfile $outputfile\n"; system "$convert -colors $colors -resize $size! $inputfile $outputfile"; } </scipt>