There several tools to perform lossless optimization of images in PNG format.
My favourite GNU/Linux distro repositories contain two ones: optipng and pngcrush.
Pngcrush is invoked as follows:
$> pngcrush -e .opt.png -brute *.png
The command tries to reduce size of all PNG files from current directory (*.png) using brute-force search (-brute). Of course, you may omit the -brute key and use default heuristics (which is much faster and produce comparable compression). Resulting files will have .opt.png suffix (-e .opt.png), i.e. vpn-nm-7.png becomes vpn-nm-7.opt.png.
In order to get more information on pngcrush command line keys type:
$> pngcrush -h | less
Another program, optipng, is a bit more friendly, for my taste.
Its syntax is quite similar:
$> optipng -keep -o7 *.png
The command optimizes all PNG images from current directory (*.png) using exhastive search (-o7) and keeps backups (-keep).
As usual, in order to get more information on optipng type:
$> man optipng
Finally, I have written down compression ratios of pngcrush and optipng on my eight small test PNG files obtained from KSnapshot.
pngcrush - 265594/292891 bytes - 90.7%
optipng - 262938/292891 bytes - 89.8%
Imagine, you could type the title of this blog in your command line. Here is a possible result of the command.
Showing posts with label less. Show all posts
Showing posts with label less. Show all posts
Saturday, May 1, 2010
Monday, April 19, 2010
Print desired number of hexdump lines with xxd
$> xxd -l 0xN0 FILE
The command prints the first N hexdump lines (-l 0xN0) of the file (FILE).
The stuff works because each line of xxd output consists of 16=0x10 octets by default, so 0xN0 is the number of octets in the first N lines.
The other useful way to view binary file is the following:
$> xxd FILE | less
The command prints the first N hexdump lines (-l 0xN0) of the file (FILE).
The stuff works because each line of xxd output consists of 16=0x10 octets by default, so 0xN0 is the number of octets in the first N lines.
The other useful way to view binary file is the following:
$> xxd FILE | less
Subscribe to:
Posts (Atom)