GraphicsMagick

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

# operator

Methods to apply mathematic or boolean operators to pixels.

# QuantumOperatorImage

## Synopsis

    MagickPassFail QuantumOperatorImage( Image *image, ChannelType channel,
                                         QuantumOperator operator, double rvalue );

## Description

QuantumOperatorImage() performs the requested arithmetic, bitwise-logical, or value operation on the selected channels of the entire image. The AllChannels channel option operates on all color channels whereas the GrayChannel channel option treats the color channels as a grayscale intensity.

These operations are on the DirectClass pixels of the image and do not update pixel indexes or colormap.

The format of the QuantumOperatorImage method is:

    MagickPassFail QuantumOperatorImage( Image *image, ChannelType channel,
                                         QuantumOperator operator, double rvalue );

image:

  The image.

channel:

  Channel to operate on (RedChannel, CyanChannel, GreenChannel, MagentaChannel, BlueChannel, YellowChannel, OpacityChannel, BlackChannel, MatteChannel, AllChannels, GrayChannel). The AllChannels type only updates color channels. The GrayChannel type treats the color channels as if they represent an intensity.

quantum_operator:

  Operator to use (AddQuantumOp, AndQuantumOp, AssignQuantumOp, DepthQuantumOp, DivideQuantumOp, GammaQuantumOp, LShiftQuantumOp, MultiplyQuantumOp, NegateQuantumOp, NoiseGaussianQuantumOp, NoiseImpulseQuantumOp, NoiseLaplacianQuantumOp, NoiseMultiplicativeQuantumOp, NoisePoissonQuantumOp, NoiseRandomQuantumOp, NoiseUniformQuantumOp, OrQuantumOp, RShiftQuantumOp, SubtractQuantumOp, ThresholdBlackQuantumOp, ThresholdQuantumOp, ThresholdWhiteQuantumOp, ThresholdBlackNegateQuantumOp, ThresholdWhiteNegateQuantumOp, XorQuantumOp).

rvalue:

  Operator argument.

exception:

  Updated with error description.

# QuantumOperatorRegionImage

## Synopsis

    MagickPassFail QuantumOperatorRegionImage( Image *image, long x, long y,
                                               unsigned long columns, unsigned long rows,
                                               ChannelType channel,
                                               QuantumOperator quantum_operator, double rvalue );

## Description

QuantumOperatorRegionImage() performs the requested arithmetic, bitwise-logical, or value operation on the selected channels of the image over the specified region. The AllChannels channel option operates on all color channels whereas the GrayChannel channel option treats the color channels as a grayscale intensity.

These operations are on the DirectClass pixels of the image and do not update pixel indexes or colormap.

The format of the QuantumOperatorRegionImage method is:

    MagickPassFail QuantumOperatorRegionImage( Image *image, long x, long y,
                                               unsigned long columns, unsigned long rows,
                                               ChannelType channel,
                                               QuantumOperator quantum_operator, double rvalue );

image:

  The image.

channel:

  Channel to operate on (RedChannel, CyanChannel, GreenChannel, MagentaChannel, BlueChannel, YellowChannel, OpacityChannel, BlackChannel, MatteChannel, AllChannels, GrayChannel). The AllChannels type only updates color channels. The GrayChannel type treats the color channels as if they represent an intensity.

x:

  Ordinate of left row of region.

y:

  Ordinate of top column of region.

columns:

  Width of region.

rows:

  Height of region.

quantum_operator:

  Operator to use (AddQuantumOp,AndQuantumOp, AssignQuantumOp, DepthQuantumOp, DivideQuantumOp, GammaQuantumOp, LShiftQuantumOp, MultiplyQuantumOp, NegateQuantumOp, NoiseGaussianQuantumOp, NoiseImpulseQuantumOp, NoiseLaplacianQuantumOp, NoiseMultiplicativeQuantumOp, NoisePoissonQuantumOp, NoiseRandomQuantumOp, NoiseUniformQuantumOp, OrQuantumOp, RShiftQuantumOp, SubtractQuantumOp, ThresholdBlackQuantumOp, ThresholdQuantumOp, ThresholdWhiteQuantumOp, XorQuantumOp).

rvalue:

  Operator argument.

exception:

  Updated with error description.

Copyright © GraphicsMagick Group 2002-2026