GraphicsMagick

- Home
- Project
- Download
- Install
- Source
- News
- Utilities
- Programming
- Reference

# transform

Crop, flip, flop, roll, coalesce, etc.

Contents

- ChopImage

- CoalesceImages

- CropImage

- DeconstructImages

- ExtentImage

- FlattenImage

- FlipImage

- FlopImage

- MosaicImages

- RollImage

- ShaveImage

- TransformImage

# ChopImage

## Synopsis

    Image *ChopImage( const Image *image,
                      const RectangleInfo *chop_info ExceptionInfo *exception );

## Description

Chop() removes a region of an image and collapses the image to occupy the removed portion.

The format of the ChopImage method is:

    Image *ChopImage( const Image *image,
                      const RectangleInfo *chop_info ExceptionInfo *exception );

image:

  The image.

chop_info:

  Define the region of the image to chop.

exception:

  Return any errors or warnings in this structure.

# CoalesceImages

## Synopsis

    Image *CoalesceImages( const Image *image, ExceptionInfo *exception );

## Description

CoalesceImages() composites a set of images while respecting any page offsets and disposal methods. GIF, MIFF, and MNG animation sequences typically start with an image background and each subsequent image varies in size and offset. CoalesceImages() returns a new sequence where each image in the sequence is the same size as the first and composited with the next image in the sequence.

The format of the CoalesceImages method is:

    Image *CoalesceImages( const Image *image, ExceptionInfo *exception );

A description of each parameter follows:

image:

  The image sequence.

exception:

  Return any errors or warnings in this structure.

# CropImage

## Synopsis

    Image *CropImage( const Image *image, const RectangleInfo *geometry,
                      ExceptionInfo *exception );

## Description

Use CropImage() to extract a region of the image starting at the offset defined by geometry. As a special feature, if the geometry "0x0" is is passed, GetImageBoundingBox() is used to locate the edges of the image and the image is cropped ("trimmed") to that boundary.

The format of the CropImage method is:

    Image *CropImage( const Image *image, const RectangleInfo *geometry,
                      ExceptionInfo *exception );

image:

  The image.

geometry:

  Define the region of the image to crop with members x, y, width, and height.

exception:

  Return any errors or warnings in this structure.

# DeconstructImages

## Synopsis

    Image *DeconstructImages( const Image *image, ExceptionInfo *exception );

## Description

DeconstructImages() compares each image with the next in a sequence and returns the maximum bounding region of any pixel differences it discovers.

The format of the DeconstructImages method is:

    Image *DeconstructImages( const Image *image, ExceptionInfo *exception );

A description of each parameter follows:

image:

  The image.

exception:

  Return any errors or warnings in this structure.

# ExtentImage

## Synopsis

    Image *ExtentImage( const Image *image, const RectangleInfo *geometry,
                        ExceptionInfo *exception );

## Description

Use ExtentImage() to change the image dimensions as specified by geometry width and height. The existing image content is composited at the position specified by geometry x and y using the image compose method. Existing image content which falls outside the bounds of the new image dimensions is discarded.

The format of the ExtentImage method is:

    Image *ExtentImage( const Image *image, const RectangleInfo *geometry,
                        ExceptionInfo *exception );

image:

  The image.

geometry:

  Define the new image dimension with width and height, and the top left coordinate to place the existing image content with x and y.

exception:

  Return any errors or warnings in this structure.

# FlattenImage

## Synopsis

    Image *FlattenImage( const Image *image, ExceptionInfo *exception );

## Description

Method FlattenImage merges a sequence of images. This is useful for combining Photoshop layers into a single image.

The format of the FlattenImage method is:

    Image *FlattenImage( const Image *image, ExceptionInfo *exception );

A description of each parameter follows:

image:

  The image sequence.

exception:

  Return any errors or warnings in this structure.

# FlipImage

## Synopsis

    Image *FlipImage( const Image *image, ExceptionInfo *exception );

## Description

FlipImage() creates a vertical mirror image by reflecting the pixels around the central x-axis.

The format of the FlipImage method is:

    Image *FlipImage( const Image *image, ExceptionInfo *exception );

A description of each parameter follows:

image:

  The image.

exception:

  Return any errors or warnings in this structure.

# FlopImage

## Synopsis

    Image *FlopImage( const Image *image, ExceptionInfo *exception );

## Description

FlopImage() creates a horizontal mirror image by reflecting the pixels around the central y-axis.

The format of the FlopImage method is:

    Image *FlopImage( const Image *image, ExceptionInfo *exception );

A description of each parameter follows:

image:

  The image.

exception:

  Return any errors or warnings in this structure.

# MosaicImages

## Synopsis

    Image *MosaicImages( const Image *image, ExceptionInfo *exception );

## Description

MosaicImages() inlays an image sequence to form a single coherent picture. It returns a single image with each image in the sequence composited at the location defined by the page member of the image structure.

The format of the MosaicImage method is:

    Image *MosaicImages( const Image *image, ExceptionInfo *exception );

A description of each parameter follows:

image:

  The image.

exception:

  Return any errors or warnings in this structure.

# RollImage

## Synopsis

    Image *RollImage( const Image *image, const long x_offset, const long y_offset,
                      ExceptionInfo *exception );

## Description

RollImage() offsets an image as defined by x_offset and y_offset.

The format of the RollImage method is:

    Image *RollImage( const Image *image, const long x_offset, const long y_offset,
                      ExceptionInfo *exception );

image:

  The image.

x_offset:

  The number of columns to roll in the horizontal direction.

y_offset:

  The number of rows to roll in the vertical direction.

exception:

  Return any errors or warnings in this structure.

# ShaveImage

## Synopsis

    Image *ShaveImage( const Image *image, const RectangleInfo *shave_info,
                       ExceptionInfo *exception );

## Description

Method ShaveImage shaves pixels from the image edges. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

The format of the ShaveImage method is:

    Image *ShaveImage( const Image *image, const RectangleInfo *shave_info,
                       ExceptionInfo *exception );

shave_image:

  Method ShaveImage returns a pointer to the shaved image. A null image is returned if there is a memory shortage or if the image width or height is zero.

image:

  The image.

shave_info:

  Specifies a pointer to a RectangleInfo which defines the region of the image to shave.

exception:

  Return any errors or warnings in this structure.

# TransformImage

## Synopsis

    MagickPassFail TransformImage( Image ** image, const char *crop_geometry,
                                   const char *image_geometry );

## Description

TransformImage() is a convenience method that behaves like ResizeImage() or CropImage() but accepts scaling and/or cropping information as a region geometry specification. If the operation fails, the original image handle is returned.

The format of the TransformImage method is:

    MagickPassFail TransformImage( Image ** image, const char *crop_geometry,
                                   const char *image_geometry );

image:

  The image to transform. The resulting transformed image is returned via this parameter.

crop_geometry:

  A crop geometry string. This geometry defines a subregion of the image to crop.

image_geometry:

  An image geometry string. This geometry defines the final size of the image.

Copyright © GraphicsMagick Group 2002 - 2024