Sponsored Links

Batch Lossy JPG And PNG Compression Script Using GraphicsMagick

WebUpd8 reader Bruce Ingalls has created a script for batch lossy compression of jpg and png files. The script is useful if you have a lot of images – e.g., you can run it to compress all the images used by a website, etc.The script compresses only the files for which the resulted compressed image is detected to be smaller than the original image file. It uses GraphicsMagick which Bruce says is better for compression than ImageMagick (~15% smaller images with GraphicsMagick than with ImageMagick) and also faster, when compressing a large number of images. Also, the script doesn’t overwrite the original files and instead, it places the compressed images under a folder called “compressed”. You can configure the compressed directory path/name, the compression ratio (40 by default) and the png compression ratio of transparent background (05 by default) by editing the script.GraphicsMagick cannot handle gif files, so it converts such files to png.The compressLossy script doesn’t do magick so don’t expect png files to be a lot smaller after compression (the compression should be more obvious for jpg files). But it makes a difference if you’re compressing a large amount of files.Download compressLossyYou can download the compressLossy script

Read more …

Comments are closed.