Book Image

ImageMagick Tricks

By : Sohail Salehi
Book Image

ImageMagick Tricks

By: Sohail Salehi

Overview of this book

<p>The book is packed with interesting and fun examples. We had a lot of fun coming up with cool ways to demonstrate ImageMagick's power, and we're sure you'll have fun learning how to create them.<br /><br />Although the printed book is in black and white, there is a full colour PDF of the screenshots freely available that includes all of the images in the book. Use it to see exactly what the ImageMagick effects look like in colour, or browse through it and see just what you'll learn to do with this book.<br /><br />ImageMagick is a free software suite to create, edit, and compose bitmap images using text-based commands. The commands can be issued from the command line, but more often will be included in web or desktop applications &acirc;&euro;&ldquo; carrying out complex image-manipulation tasks in response to the user's input.<br /><br />ImageMagick is a popular way for generating images on-the-fly in web pages, whether it's generating thumbnails from a large image, or creating complex combinations of images, text, and effects chosen by a visitor or the web site's creator.</p>
Table of Contents (18 chapters)
ImageMagick Tricks
Credits
About the Author
About the Reviewers
Preface
5
Identify, Display, and Import
Index

Lossy versus Lossless Compression Algorithms


The image compression algorithms can be divided into two main groups. An algorithm in which the original image data will remain unchanged after compression and decompression phases is called a lossless algorithm. LZW and RLE are the most famous types of lossless algorithms. These algorithms are mainly used on image formats that contain a color palette like .gif, .png and so on

The main limitation in these formats is the number of colors. The colors in each channel cannot exceed 256. So these formats are not suitable for saving true-color images. Also for saving images with non-uniform adjacent pixels these formats are not optimal.

In contrast for saving images with solid background or minimum number of colors they considerably optimize the image size and displaying speed.

In the following figure you can compare several versions of two images, which are saved in the .gif, .png, and .jpg formats.

Fig B-1: A Comparison between Lossy and Lossless Image Formats

In a lossy compression algorithm, due to the quality that we have specified for compression, some of the image data will be omitted. This will produce more compression and the resulting image will have a smaller size than with the lossless methods. You may imagine that eliminating some image data will reduce the quality and generate a poor noisy image. In fact although we lose some data from the original image, due to the internal algorithm of lossy compressions the changed or lost pixel color will not be noticeable.

In the following image you can see and compare two levels of quality for creating .jpg images from a raw .bmp file. As you can see the changed pixels can be recognized if we focus on them.

Fig B-2: A Comparison between Lossy Image Formats and Raw Data