Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

GraphicsMagick: Compression Methods

📅 2010-Apr-12 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ graphicsmagick ⬩ 📚 Archive

GraphicsMagick programs take a compression method parameter specified by using the -compress option. For example:

$ gm convert -compress JPEG scans-*.jpeg fooBar.pdf

The resulting image quality and filesize depends on the compression method used. Here is the resulting filesize comparison for the various compression methods on a conversion of 3 JPEG images (~270 KB each) to a PDF file:

117037  Fax
729912  JPEG
1282909 Zip
1458566 LZW
1797160 RLE
1797160 Lossless
1797160 Group4
1797160 BZip
8300344 None

The default compression method used, when the -compress option is not specified, depends on the output filetype. For example, the default compression method used to convert to PDF was found to be Zip.

Tried with: GraphicsMagick 1.3.5 2009-01-26 Q8

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧