Sizing and Transforming Images
A lot of image manipulation tasks consist of little more than
resizing and cropping existing images. Table 3-3 shows the Image::Magick
attributes that provide sizing and resolution information about an
image. The page and density attributes may be set (with Set( )) to control the image size and
resolution before reading in a PostScript file. The size attribute can be similarly set before
creating images from raw data formats.
Attribute | Read | Write | Description |
| Yes | No | Returns an integer that is the width of the image before any transformations have been performed. |
| Yes | No | Returns an integer that is the height of the image before any transformations have been performed. |
| Yes | No | Returns the width (integer number of pixel columns) of the image. |
| Yes | Yes | Use this attribute to
set the vertical and horizontal resolution of an image. Set
the density to a string in the form
‘ The default is 72 dots per inch. Increase this to 144, for example, to render the PostScript to a larger sized image. |
| Yes | No | Returns the bounds of
the image. The geometry=>'640x800' is equivalent to: width=>640, height=>800 To refer to a 20x20 region of pixels starting at coordinate (100,150), ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access