Re: Compressing images without compressing quality

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-06-14 at 12:08 +0100, Paul Smith wrote:
> On 6/14/06, Ben Lancaster <lists@xxxxxxxxxxxxxxxxxx> wrote:
> > >> some tool to automatically crop images. Any suggestions?
> > >
> > > Gimp scripting is what you're looking for.
> >
> > ...or ImageMagick and a bash script if you felt that way inclined.
> 
> Thanks for all suggestions. pngcrush seems quite effective!
> 
> Paul
> 
This is an exellent script I found on the web, that really compresses
png files:
###########
#!/bin/bash

# create backup copy
cp $1 $1.orig
#convert the image to indexed
convert -quality 0 +dither -colors 256 $1.orig $1
# shrink the PNG using three tools
pngrewrite $1 $1
optipng -zc1-9 -zm1-9 -zs0-2 -f0-5 $1
advpng -z4 $1

# display file sizes of the original and compressed image
ls -sla $1*
###########
It depends on three tools: pngrewrite, optipng and advpng.
If the image is a photo it may be a good idea not to convert it to
indexed, but then the gain will be smaller.

and this will compress all the png images in the current directory:
###########
#!/bin/bash
#
# This script converts all PNG files in the current directory to
# 256-color indexed using maximum compression.
#
# Written by Frank Schoep
#

# get file list and loop through all files
FILES=`ls -1S *.png`
for FILE in $FILES
do
cp $FILE $FILE.orig
convert -quality 0 +dither -colors 256 $FILE $FILE

pngrewrite $FILE $FILE
optipng -zc1-9 -zm1-9 -zs0-2 -f0-5 $FILE
advpng -z4 $FILE
done
###########

Greetings,
-- 
Peter Kostov
Sofia, Bulgaria

Photographer, web designer,
3D modeling, informational services

Home site: http://www.light-bg.com


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux