ImageMagick: MagickCore, C API for ImageMagick: Shear or Rotate an Image by an Arbitrary Angle
Author: ImageMagick Studio LLC
Description: ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (about 100) including GIF, JPEG, JPEG-2000, PNG, PDF, PhotoCD, TIFF, and DPX. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you can freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems. The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite programming language. Choose from these interfaces: MagickCore (C), MagickWand (C), ChMagick (Ch), Magick++ (C++), JMagick (Java), L-Magick (Lisp), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (P [cell cut: 1167 characters, first 1000 kept]
Keywords: magickcore, c, api, for, imagemagick:, shear, or, rotate, an, image, by, an, arbitrary, angle, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject, Swiss, Army, Knife, Image, Processing

Unix
Mac OS X
Windows
Processing
Options
Usage
MagickWand
MagickCore
PerlMagick
Magick++
Unix
Windows
Links

## AffineTransformImage

AffineTransformImage() transforms an image as dictated by the affine matrix. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

The format of the AffineTransformImage method is:

      Image *AffineTransformImage(const Image *image,
        AffineMatrix *affine_matrix,ExceptionInfo *exception)

A description of each parameter follows:

##### image

the image.

##### affine_matrix

the affine matrix.

##### exception

return any errors or warnings in this structure.

## DeskewImage

DeskewImage() removes skew from the image. Skew is an artifact that occurs in scanned images because of the camera being misaligned, imperfections in the scanning or surface, or simply because the paper was not placed completely flat when scanned.

The format of the DeskewImage method is:

      Image *DeskewImage(const Image *image,const double threshold,
        ExceptionInfo *exception)

A description of each parameter follows:

##### image

the image.

##### threshold

separate background from foreground.

##### exception

return any errors or warnings in this structure.

## RotateImage

RotateImage() creates a new image that is a rotated copy of an existing one. Positive angles rotate counter-clockwise (right-hand rule), while negative angles rotate clockwise. Rotated images are usually larger than the originals and have 'empty' triangular corners. X axis. Empty triangles left over from shearing the image are filled with the background color defined by member 'background_color' of the image. RotateImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.

RotateImage() is based on the paper "A Fast Algorithm for General Raster Rotatation" by Alan W. Paeth. RotateImage is adapted from a similar method based on the Paeth paper written by Michael Halle of the Spatial Imaging Group, MIT Media Lab.

The format of the RotateImage method is:

      Image *RotateImage(const Image *image,const double degrees,
        ExceptionInfo *exception)

A description of each parameter follows.

##### image

the image.

##### degrees

Specifies the number of degrees to rotate the image.

##### exception

return any errors or warnings in this structure.

## ShearImage

ShearImage() creates a new image that is a shear_image copy of an existing one. Shearing slides one edge of an image along the X or Y axis, creating a parallelogram. An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x_shear is measured relative to the Y axis, and similarly, for Y direction shears y_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the background color defined by member 'background_color' of the image.. ShearImage() allocates the memory necessary for the new Image structure and returns a pointer to the new image.

ShearImage() is based on the paper "A Fast Algorithm for General Raster Rotatation" by Alan W. Paeth.

The format of the ShearImage method is:

      Image *ShearImage(const Image *image,const double x_shear,
        const double y_shear,ExceptionInfo *exception)

A description of each parameter follows.

##### image

the image.

##### x_shear, y_shear

Specifies the number of degrees to shear the image.

##### exception

return any errors or warnings in this structure.

Discourse Server • Studio