X-Git-Url: https://granicus.if.org/sourcecode?a=blobdiff_plain;f=www%2Ffx.html;h=5efd6688d3929ef90a20d38bc353c8af9d5279ce;hb=075ad25a9c1669a298a84101add52b82724d4c33;hp=67e100347279876676164cfce9a63d457e20d0d8;hpb=83a272ecd5c0a2f5dc501872d84d8f934c0dcc38;p=imagemagick diff --git a/www/fx.html b/www/fx.html index 67e100347..5efd6688d 100644 --- a/www/fx.html +++ b/www/fx.html @@ -3,20 +3,17 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - - - - ImageMagick: The Fx Special Effects Image Operator + + + ImageMagick: The Fx Special Effects Image Operator + + + - @@ -25,6 +22,12 @@ + + + + @@ -43,12 +46,25 @@ style="width: 114px; height: 118px; border: 0px; float: right;" /> -
+
+ +
+ Unix +
+ +
+ Windows +
+
@@ -76,9 +92,6 @@ -
-
- Unix -
- - -
@@ -125,30 +128,45 @@ +
+
- +
+ +
@@ -223,7 +241,7 @@
constants:
e, Epsilon, QuantumRange, QuantumScale, Opaque, Pi, Transparent
Fx operators (in order of precedence):
-
^ (power), *, /, % (modulo), +, -, +
^ (power), unary -, *, /, % (modulo), +, -, <<, >>, <, <=, >, >=, ==, !=, & (bitwise AND), | (bitwise OR), && (logical AND), || (logical OR), @@ -231,7 +249,7 @@
math functions:
abs(), acos(), airy(), alt(), asin(), atan(), atan2(), ceil(), cos(), cosh(), debug(), exp(), floor(), hypot(), int(), j0(), j1(), jinc(), ln(), log(), logtwo(), max(), min(), mod(), pow(), rand(), round(), - sign(), sin(), sinc(), sinh(), sqrt(), tan(), tanh()
+ sign(), sin(), sinc(), sinh(), sqrt(), tan(), tanh(), trunc()
channel functions:
channel(r,g,b,a), channel(c,m,y,k,a)
color names:
@@ -375,6 +393,7 @@
  • sqrt(x): square root function
  • tan(x): tangent function
  • tanh(x): hyperbolic tangent function
  • +
  • trunc(x): round to integer, towards zero
  • The expression semantics include these rules:

    @@ -385,8 +404,11 @@
  • 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 an exception and have no effect; e.g. r=3.0; r returns the pixel red color value, not 3.0
  • +
  • Unary operators have a lower priority than binary operators, that is, the unary minus (negation) has lower precedence than exponentiation, so -3^2 is interpreted as -(3^2) = -9. Use parentheses to clarify your intent (e.g. (-3)^2 = 9).
  • +
  • Similarly, care must be exercised when using the slash ('/') symbol. The string of characters 1/2x is interpreted as (1/2)x. The contrary interpretation should be written explicitly as 1/(2x). Again, the use of parentheses helps clarify the meaning and should be used whenever there is any chance of misinterpretation.
  • +

    Source Images

    @@ -460,6 +482,8 @@

    $magick> convert xc:'rgb(25%,50%,75%)' rose: -colorspace rgb \
    -format 'Red channel of NW corner of image # %[fx:t] is %[fx: s]' info:
    Red channel of NW corner of image # 0 is 0.250004
    Red channel of NW corner of image # 1 is 0.188235

    +

    Use %[fxc: ] if your expression is a constant (e.g. %[fxc:page.x/2]. The result is cached and the cached result returned rather than evaluating the expression each time.

    +

    The color-escape %[pixel: ] is evaluated once per image and per color channel in that image (-channel is ignored), The values generated are then converted into a color string (a named color or hex color value). The symbols i and j are set to zero, and s and t refer to each successively current image and index.

    @@ -468,10 +492,10 @@ @@ -480,5 +504,16 @@ Contact the Wizards
    +