|Figures from chapter 2 of ImageMagick, the definitive guide|
posted at: 10:00 | path: /imagemagick/book/figures | permanent link to this entry
Figures 2-7 through 2-16 are in the eBook I downloaded, but they seem to be missing here on your website. Could you please post them?
Chapter Two has a significant error on page 38, regarding the -resize option. Although no image is associated with this issue, I felt it best to put my comment in this section.
The error is in the description of what happens with the command:
"convert -resize 42x148 input.jpg output.jpg"
The description indicates that if the input.jpg aspect ration does not exactly fit the 42x148 widthxheight parameters, the output image will be distorted, since the dimensions will be forced. This is not correct. The dimensions given will be used as a maximum sized bounding box, within which the output image will be required to fit, while preserving the input aspect ratio. This is described clearly on the imagemagick website at:
The correct way to force dimensions is with an exclamation point after the dimensions. In the case of the above command, use:
"convert -resize 42x148! input.jpg output.jpg"
It was a bit disconcerting to find so basic an error on one of the the very first examples of code in the book. It makes me wonder what is in store for me in the rest of the book.
You're right. You've found a bug. The paragraph reads:
"Absolute size: You can specify the exact size of output image you want by using pixels. The first number is the new width of the image, and the second number is the new height of the image. The following example code resizes an image to be 42x148 pixels. You need to be careful of this option, however, because it will change the aspect ratio of the image. The aspect ratio is the ratio..."
(Shortened for clarity).
All I can do at this point is apologize for the mistake, and explain that the error made it through my initial error, an editor's review, a technical review (or more, depending on the chapter), and an additional review from me. The reality is that books are complicated projects, and that it's very hard to gaurantee that everything is exactly right. When you right a book over many months (nine in the case of this book) in your free time, as most technical books are, then it there is the risk that some things might occassionally go wrong.
I would hope that you will find other elements of the book which contain merit, despite this erroneous paragraph. You should also note that I should further clarify the descrition of geometries on page 47 as well, to make this behaviour clearer.
I will report the error to the publisher, and if a second edition is ever produced will correct the error before the book goes to print.