GraphicsMagick Search site

- Home
- License
- Mission
- Download
- Installation
- FAQ
- News
- Formats

- Process
- Contribute
- CVS
- Mailing Lists
- ChangeLog
- Report Bugs
- Utilities
- Programming
- Links

# fx

## Image special effects methods

Contents

- CharcoalImage
- ColorizeImage
- ColorMatrixImage
- ImplodeImage
- MorphImages
- OilPaintImage
- SolarizeImage
- SteganoImage
- StereoImage
- SwirlImage
- WaveImage

# CharcoalImage

## Synopsis

    Image *CharcoalImage( const Image *image, const double radius, const double sigma,
                          ExceptionInfo *exception );

## Description

Method CharcoalImage creates a new image that is a copy of an existing one with the edge highlighted. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

The format of the CharcoalImage method is:

    Image *CharcoalImage( const Image *image, const double radius, const double sigma,
                          ExceptionInfo *exception );

charcoal_image:
  Method CharcoalImage returns a pointer to the image after it is embossed. A null image is returned if there is a memory shortage.
image:
  The image.
radius:
  the radius of the pixel neighborhood.
sigma:
  The standard deviation of the Gaussian, in pixels.
exception:
  Return any errors or warnings in this structure.

# ColorizeImage

## Synopsis

    Image *ColorizeImage( const Image *image, const char *opacity,
                          const PixelPacket target, ExceptionInfo *exception );

## Description

ColorizeImage() blends the fill color with each pixel in the image. A percentage blend is specified with opacity. Control the application of different color components by specifying a different percentage for each component (e.g. 90/100/10 is 90% red, 100% green, and 10% blue).

The format of the ColorizeImage method is:

    Image *ColorizeImage( const Image *image, const char *opacity,
                          const PixelPacket target, ExceptionInfo *exception );

image:
  The image.
opacity:
  A character string indicating the level of opacity as a percentage.
target:
  A color value.
exception:
  Return any errors or warnings in this structure.

# ColorMatrixImage

## Synopsis

    MagickPassFail ColorMatrixImage( Image *image, const unsigned int order,
                                     const double *color_matrix );

## Description

ColorMatrixImage() applies a color matrix to the image channels. The user supplied matrix may be of order 1 to 5 (1x1 through 5x5) and is used to update the default identity matrix:

1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1

where the first four columns represent the ratio of the color (red, green, blue) and opacity components incorporated in the output summation. The first four rows represent the summations for red, green, blue, and opacity. The last row is a dummy row and is not used. The last column represents a constant value (expressed as a ratio of MaxRGB) to be added to the row summation. The following is a summary of how the matrix is applied:

r' = r*m[0,0] + g*m[1,0] + b*m[2,0] + o*m[3,0] + MaxRGB*m[4,0] g' = r*m[0,1] + g*m[1,1] + b*m[2,1] + o*m[3,1] + MaxRGB*m[4,1] b' = r*m[0,2] + g*m[1,2] + b*m[2,2] + o*m[3,2] + MaxRGB*m[4,2] o' = r*m[0,3] + g*m[1,3] + b*m[2,3] + o*m[3,3] + MaxRGB*m[4,3]

The format of the ColorMatrixImage method is:

    MagickPassFail ColorMatrixImage( Image *image, const unsigned int order,
                                     const double *color_matrix );

image:
  The image.
order:
  The number of columns and rows in the filter kernel.
matrix:
  An array of double representing the matrix

# ImplodeImage

## Synopsis

    Image *ImplodeImage( const Image *image, const double amount,
                         ExceptionInfo *exception );

## Description

Method ImplodeImage creates a new image that is a copy of an existing one with the image pixels "implode" by the specified percentage. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

The format of the ImplodeImage method is:

    Image *ImplodeImage( const Image *image, const double amount,
                         ExceptionInfo *exception );

implode_image:
  Method ImplodeImage returns a pointer to the image after it is implode. A null image is returned if there is a memory shortage.
image:
  The image.
amount:
  Define the extent of the implosion.
exception:
  Return any errors or warnings in this structure.

# MorphImages

## Synopsis

    Image *MorphImages( const Image *image, const unsigned long number_frames,
                        ExceptionInfo *exception );

## Description

The MorphImages() method requires a minimum of two images. The first image is transformed into the second by a number of intervening images as specified by frames.

The format of the MorphImage method is:

    Image *MorphImages( const Image *image, const unsigned long number_frames,
                        ExceptionInfo *exception );

image:
  The image.
number_frames:
  Define the number of in-between image to generate. The more in-between frames, the smoother the morph.
exception:
  Return any errors or warnings in this structure.

# OilPaintImage

## Synopsis

    Image *OilPaintImage( const Image *image, const double radius,
                          ExceptionInfo *exception );

## Description

OilPaintImage() applies a special effect filter that simulates an oil painting. Each pixel is replaced by the most frequent color occurring in a circular region defined by radius.

The format of the OilPaintImage method is:

    Image *OilPaintImage( const Image *image, const double radius,
                          ExceptionInfo *exception );

image:
  The image.
radius:
  The radius of the circular neighborhood.
exception:
  Return any errors or warnings in this structure.

# SolarizeImage

## Synopsis

    unsigned int SolarizeImage( Image *image, const double threshold );

## Description

SolarizeImage() applies a special effect to the image, similar to the effect achieved in a photo darkroom by selectively exposing areas of photo sensitive paper to light. Threshold ranges from 0 to MaxRGB and is a measure of the extent of the solarization. False is returned if an error is encountered.

The format of the SolarizeImage method is:

    unsigned int SolarizeImage( Image *image, const double threshold );

A description of each parameter follows:

image:
  The image.
threshold:
  Define the extent of the solarization.

# SteganoImage

## Synopsis

    Image *SteganoImage( const Image *image, Image *watermark,
                         ExceptionInfo *exception );

## Description

Use SteganoImage() to hide a digital watermark within the image. Recover the hidden watermark later to prove that the authenticity of an image. Offset defines the start position within the image to hide the watermark.

The format of the SteganoImage method is:

    Image *SteganoImage( const Image *image, Image *watermark,
                         ExceptionInfo *exception );

image:
  The image.
watermark:
  The watermark image.
exception:
  Return any errors or warnings in this structure.

# StereoImage

## Synopsis

    Image *StereoImage( const Image *image, const Image *offset_image,
                        ExceptionInfo *exception );

## Description

StereoImage() combines two images and produces a single image that is the composite of a left and right image of a stereo pair. Special red-green stereo glasses are required to view this effect.

The format of the StereoImage method is:

    Image *StereoImage( const Image *image, const Image *offset_image,
                        ExceptionInfo *exception );

stereo_image:
  Method StereoImage returns a pointer to the stereo image. A null image is returned if there is a memory shortage.
image:
  The image.
offset_image:
  Another image.
exception:
  Return any errors or warnings in this structure.

# SwirlImage

## Synopsis

    Image *SwirlImage( const Image *image, double degrees, ExceptionInfo *exception );

## Description

SwirlImage() swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360.

The format of the SwirlImage method is:

    Image *SwirlImage( const Image *image, double degrees, ExceptionInfo *exception );

image:
  The image.
degrees:
  Define the tightness of the swirling effect.
exception:
  Return any errors or warnings in this structure.

# WaveImage

## Synopsis

    Image *WaveImage( const Image *image, const double amplitude, const double wave_length,
                      ExceptionInfo *exception );

## Description

The WaveImage() filter creates a "ripple" effect in the image by shifting the pixels vertically along a sine wave whose amplitude and wavelength is specified by the given parameters.

The format of the WaveImage method is:

    Image *WaveImage( const Image *image, const double amplitude, const double wave_length,
                      ExceptionInfo *exception );

image:
  The image.
amplitude, frequency:
  Define the amplitude and wave_length of the sine wave.
exception:
  Return any errors or warnings in this structure.