## The `Transform' method

Argument: See text
Result: None

Valid for: Image

The ImageMagick package which is accessed from the APLX Image object includes a very wide range of functions for transforming an image. For example, you can shear, scale, crop, rotate or skew the image, sharpen edges, adjust colors and intensity, and filter out noise. You can also apply special effects to the image, such as making it look like a charcoal drawing or an oil painting. The `Transform` method of the APLX Image object allows you to use many of these functions directly.

The syntax of the `Transform` method is:

          ControlName.Transform 'Keyword' Arg1 Arg2...
    or
         'ControlName' ŚWI 'Transform' 'Keyword' Arg1 Arg2...

where `Keyword` selects the transformation you want to carry out, and the remaining arguments depend on the transformation (they are all numeric, with the scale always being pixels). Keywords are not case-sensitive. The following is a list of the supported transformations and arguments, together with the name of the underlying ImageMagick operation. See the ImageMagick documentation for full details of the operations and parameters.

#### Geometric transformations and scaling

Flip image about horizontal axis: (`MagickFlipImage`)

         Object.Transform 'Flip'

Flip image about vertical axis: (`MagickFlopImage`)

         Object.Transform 'Flop'

Scale image to twice current size: (`MagickMagnifyImage`)

         Object.Transform 'Magnify'

Scale image to half current size: (`MagickMinifyImage`)

         Object.Transform 'Minify'

Scale image to specified X Y size: (`MagickScaleImage`)

         Object.Transform 'Scale' x y

Roll image: (`MagickRollImage`)

         Object.Transform 'Roll' x_offset y_offset

Extract a rectangular region from the image: (`MagickCropImage`)

         Object.Transform 'Crop' width height x y

Rotate image clockwise by specified number of degrees: (`MagickRotateImage`)

         Object.Transform 'Rotate' degrees

Shear the image along X or Y axis, or both: (`MagickShearImage`)

         Object.Transform 'Shear' x_shear y_shear

#### Image enhancement and adjustment

Reduce the speckle noise in an image: (`MagickDespeckleImage`)

         Object.Transform 'Despeckle'

Apply digital filter to improve noisy image: (`MagickEnhanceImage`)

         Object.Transform 'Enhance'

Apply Median filter to improve noisy image: (`MagickMedianFilterImage`)

         Object.Transform 'MedianFilter' radius

Equalize the image color histogram: (`MagickEqualizeImage`)

         Object.Transform 'Equalize'

Enhance the contrast of a color image: (`MagickNormalizeImage`)

         Object.Transform 'Normalize'

Sharpen an image: (`MagickSharpenImage`)

         Object.Transform 'Sharpen' radius sigma

Sharpen image with a Gaussian operator: (`MagickUnsharpMaskImage`)

         Object.Transform 'UnsharpMask' radius sigma amount threshold

Enhance edges using a convolution filter of the given radius: (`MagickEdgeImage`)

         Object.Transform 'Edge' radius

Smooth contours of image, preserving edge information: (MagickReduceNoiseImage)

         Object.Transform 'ReduceNoise' radius

Adjust brightness, saturation, and hue of the image: (`MagickModulateImage`)

         Object.Transform 'Modulate' brightness saturation hue

Gamma-correct an image: (`MagickGammaImage`)

         Object.Transform 'Gamma' gamma

#### Special effects

Implode pixels by specified amount: (`MagickImplodeImage`)

         Object.Transform 'Implode'  amount

Make image look like an oil painting: (`MagickOilPaintImage`)

         Object.Transform 'OilPaint' radius

Make image look like a charcoal drawing: (`MagickCharcoalImage`)

         Object.Transform 'Charcoal' radius sigma

Add three-dimensional effect to grayscale image: (`MagickEmbossImage`)

         Object.Transform 'Emboss' radius sigma

Randomly displace each pixel in a block: (`MagickSpreadImage`)

         Object.Transform 'Spread' radius

Swirl the pixels about the center of the image: (`MagickSwirlImage`)

         Object.Transform 'Swirl' degrees

Change pixel values depending on intensity relative to threshold: (`MagickThresholdImage`)

         Object.Transform 'Threshold' threshold

Apply effect similar to exposing photo paper to light: (`MagickSolarizeImage`)

         Object.Transform 'Solarize' threshold

Blur image: (`MagickBlurImage`)

         Object.Transform 'Blur' radius sigma

Blur image (Gaussian blur): (`MagickGaussianBlurImage`)

         Object.Transform 'GaussianBlur' radius sigma

Blur image radially: (`MagickRadialBlurImage`)

         Object.Transform 'RadialBlur' angle

Simulate motion blur: (`MagickMotionBlurImage`)

         Object.Transform 'MotionBlur' radius sigma angle

Create ripple effect in image: (`MagickWaveImage`)

         Object.Transform 'Wave' amplitude wave_length

Adjust levels of image: (`MagickLevelImage`)

         Object.Transform 'Level' blackpoint gamma whitepoint

Force all pixels below threshold to black: (`MagickBlackThresholdImage`)

         Object.Transform 'BlackThreshold' threshold

Force all pixels above threshold to white: (`MagickWhiteThresholdImage`)

         Object.Transform 'WhiteThreshold' threshold

### Examples of image transformations

Original image |
Obj.Transform 'Flop' |
Obj.Transform 'Implode' 1 |
Obj.Transform 'Solarize' 0.3 |

The workspace `10 HELPTRANSFORM` has a demonstration of these and other image transformations.

Topic: APLX Help : System Classes : Methods : Transform

[ Previous | Next | Contents | Index ]