# Image Effects

You have your choice of these special effects:

Charcoal drawing
simulate a charcoal drawing. Good parameter values are odd numbers from 3 to 31

Convolve
apply a convolution kernel to the image. Given the kernel order, you would supply order*order float values. For example, the parameter would look like this for a 3x3 Gaussian kernel:

```    1, 2, 1, 2, 4, 2, 1, 2, 1
```

Fx
evaluate expression for each pixel in the specified channel. The Fx expressions includes any combination of the following:
• x ^ y: exponentiation (xy)
• ( ... ): grouping
• x * y: multiplication (the asterisk * is optional, for example, 2u or 2(x+y) are acceptable)
• x / y: division
• x % y: modulo
• x + y: addition
• x - y: subtraction
• x << y: left shift
• x >> y: right shift
• x < y: boolean relation, returns value 1.0 if x < y, otherwise 0.0
• x <= y: boolean relation, returns value 1.0 if x <= y, otherwise 0.0
• x > y: boolean relation, returns value 1.0 if x > y, otherwise 0.0
• x >= y: boolean relation, returns value 1.0 if x >= y, otherwise 0.0
• x == y: boolean relation, returns value 1.0 if x == y, otherwise 0.0
• x != y: boolean relation, returns value 1.0 if x != y, otherwise 0.0
• x & y: binary AND
• x | y: binary OR
• x && y: logical AND connective, returns value 1.0 if x > 0 and y > 0, otherwise 0.0
• x || y: logical OR connective (inclusive), returns value 1.0 if x > 0 or y > 0 (or both), otherwise 0.0
• ~x: logical NOT operator, returns value 1.0 if not x > 0, otherwise 0.0
• +x: unary plus, returns 1.0*value
• -x: unary minus, returns -1.0*value
• x ? y : z: ternary conditional expression, returns value y if x > 0, otherwise z; only one ternary conditional permitted per statement
• x = y: assignment
• x ; y: statement separator
• pi: constant (3.141659...)
• e: constant (2.71828...)
• QuantumRange: constant maximum pixel value (255 for Q8, 65535 for Q16)
• QuantumScale: constant 1.0/QuantumRange
• intensity: pixel intensity
• hue: pixel hue
• saturation: pixel saturation
• luminosity: pixel luminosity
• red, green, blue, etc.: color names
• #ccc, #cbfed0, #b9e1cc00, etc.: color hex values
• rgb(), rgba(), cmyk(), cmyka(), hsl(), hsla(): color functions
• s,t,u,v,n,i,j,w,h,z,r,g,b,a,o,c,y,m,k: symbols
• abs(x): absolute value function
• acos(x): arc cosine function
• alt(x): sign alternation function (returns 1 if int(x) is even, -1 if int(x) is odd)
• asin(x): arc sine function
• atan(x): arc tangent function
• atan2(y,x): arc tangent function of two variables
• ceil(x): smallest integral value not less than argument
• cos(x): cosine function
• debug(x): print value for debugging
• exp(x): natural exponential function (ex)
• floor(x): largest integral value not greater than argument
• int(x): greatest integer function (returns greatest integer less than or equal to x)
• ln(x): natural logarithm function
• log(x): logarithm base 10
• max(x, y): maximum of x and y
• min(x, y): minimum of x and y
• mod(x, y): floating-point remainder function
• pow(x,y): power function (xy)
• rand(): value uniformly distributed over the interval [0.0, 1.0) with a 2 to the 128th-1 period
• sign(x): returns 1 if x is less than 0 otherwise 1
• sin(x): sine function
• sqrt(x): square root function
• tan(x): tangent function

• The expression semantics include these rules:
• symbols are case insensitive
• only one ternary conditional (e.g. x ? y : z) per statement
• statements are assignments or the final expression to return
• an assignment starts a statement, it is not an operator
• assignments to built-ins do not throw errors and have no effect; e.g. r=3.0; r returns the pixel red color value, not 3.0

• Implode
implode/explode image pixels about the center. A positive parameter implodes while a negative parameter explodes the image.

mosaic
create an mosaic from an image sequence.

Morph
morphs an image sequence. Both the image pixels and size are linearly interpolated to give the appearance of a meta-morphosis from one image to the next. Specify the parameter as the number of in-between images to generate. If you have a single image in your sequence, the clipboard image is used as the morph anchor.

Oil Paint
simulate an oil painting. Each pixel is replaced by the most frequent color in a circular neighborhood whose width is specified as a radius. Good parameter values are odd numbers from 3 to 31

Recolor
translate, scale, shear, or rotate image colors. Although you can use variable sized matrices, typically you use a 5 x 5 for an RGBA image and a 6x6 for CMYKA. Populate the last row with normalized values to translate. For example to double the red component and add 20% to each of red, green, and blue, use:
```  2.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.2,0.2,0.2,0.0,1.0
```

Sepia Tone
apply a special effect to the image, similar to the effect achieved in a photo darkroom by sepia toning. Threshold ranges from 0 to MaxRGB and is a measure of the extent of the sepia toning. A threshold of 80% is a good starting point for a reasonable tone.

simulate an image shadow. Start with a parameter of 50x5+20+30. The first value is the percent opacity, the second is the blur sigma value, and the third and fourth value is the shadow offset relative to the original image

Sketch
simulate a pencil sketch. Try a parameter of 0x20+135.

Solarize
negate all pixels above the threshold level. Specify the parameter as the percent threshold of the intensity (0 - 99.9%).

Stegano
hide the clipboard image within this image. The parameter is the offset within the image to begin any hiding.

Stereo
combine two image to create a stereo anaglyph. The left side of the stereo pair is saved as the red channel of the output image. The right sife is saved as the green channel. Red-blue stereo glasses are required to properly view the stereo image.

Swirl
swirl image pixels about the center. Degrees defines the tightness of the swirl.

Tint
tint the image with the fill color. Tint applies a color vector to each pixel in the image. The length of the vector is 0 for black and white and at its maximum for the midtones. The vector weighting function in between is f(x) = (1-(4.0*((x-0.5)*(x-0.5)))). The dynamic weighting can be controlled by a constant percentage (0..100) given as the parameter for tint (e.g. 50%). Usually de-saturating the image is what you want before tinting.

Vignette
soften the edges of the image in vignette style. Start with a parameter of 0x20. The first value is the blur radius, the second is the blur sigma value, and the third and fourth value is the vignette offset relative to the original image

Wave
alter an image along a sine wave. Specify amplitude and wavelength as the parameter to effect the characteristics of the wave:
```    <amplitude>x<wavelength>
```

See examples of select ImageMagick Studio effects.