BlogBlog ÜbersichtjailscriptportsoptFreeBSDLinksThermoskanne

Grösse von png-Bilder verkleinern

Möchte man die Grösse von png-Bilder verkleinern, kann pngcrush dazu verwendet werden. Im FreeBSD-Portbaum findet man pngcrush unter graphics/pngcrush:

# cd /usr/ports/graphics/pngcrush && make install clean

Benutzer von pkgng können pngcrush wie folgt installieren:

# pkg install pngcrush

Mit der -e Option kann der Suffix der verkleinerten Datei angegeben werden, danach optimiert pngcrush die png-Datei und speichert die verkleinerte Datei mit dem entsprechenden Suffix:

# pngcrush -e -opt.png photo.png

 | pngcrush 1.7.24
 |    Copyright (C) 1998-2002,2006-2012 Glenn Randers-Pehrson
 |    Portions copyright (C) 2005       Greg Roelofs
 | This is a free, open-source program.  Permission is irrevocably
 | granted to everyone to use this version of pngcrush without
 | payment of any fee.
 | Executable name is pngcrush
 | It was built with libpng version 1.4.11, and is
 | running with  libpng version 1.4.11 - March 29, 2012

 |    Copyright (C) 1998-2004, 2006-2012 Glenn Randers-Pehrson,
 |    Copyright (C) 1996, 1997 Andreas Dilger,
 |    Copyright (C) 1995, Guy Eric Schalnat, Group 42 Inc.,
 | and zlib version 1.2.5, Copyright (C) 1995-2010 (or later),
 |    Jean-loup Gailly and Mark Adler.
 | It was compiled with gcc version 4.2.1 20070831 patched [FreeBSD].

   Recompressing photo.png
   Total length of data found in IDAT chunks    =   169558
   IDAT length with method   1 (fm 0 zl 4 zs 0) =   113517
   IDAT length with method   2 (fm 1 zl 4 zs 0) =   128112
   IDAT length with method   3 (fm 5 zl 4 zs 1) =   182436
   IDAT length with method   4 (fm 0 zl 9 zs 1) =   119126
   IDAT length with method   7 (fm 0 zl 9 zs 0) =    95461
   Best pngcrush method = 7 (fm 0 zl 9 zs 0)
for photo-opt.png
     (43.70% IDAT reduction)
     (42.80% filesize reduction)

   CPU time decoding 0.117, encoding 0.273, other 0.031, total 0.422 seconds

# ls -lart *png
-rw-r--r--  1 beat  beat  173775 Jun  2 20:11 photo.png
-rw-r--r--  1 beat  beat   99406 Jun  2 20:14 photo-opt.png

Mehr Informationen zu pngcrush erhält man mit der -h Option.

 Permalink