Pike v8.1 release 6

Class Image.Image

Description

The main object of the Image module, this object is used as drawing area, mask or result of operations.

basic:
clear, clone, create, xsize, ysize

plain drawing:
box, circle, getpixel, line, setcolor, setpixel, threshold, polyfill

operators:
`&, `*, `+, `-, `==, `>, `<, `|

pasting images:
paste, paste_alpha, paste_alpha_color, paste_mask

getting subimages, scaling, rotating:
autocrop, clone, copy, dct, mirrorx, rotate, rotate_ccw, rotate_cw, rotate_expand, scale, skewx, skewx_expand, skewy, skewy_expand

calculation by pixels:
apply_matrix, change_color, color, distancesq, grey, invert, modify_by_intensity, outline select_from, rgb_to_hsv, hsv_to_rgb, rgb_to_yuv, yuv_to_rgb,

average, max, min, sum, sumf, find_min, find_max

special pattern drawing:
noise, turbulence, test, tuned_box, gradients, random

See also

Image, Image.Font, Image.Colortable, Image.X


Method create

Image.Image Image.Image()
Image.Image Image.Image(Image.Image image)
Image.Image Image.Image(int xsize, int ysize)
Image.Image Image.Image(int xsize, int ysize, Color color)
Image.Image Image.Image(int xsize, int ysize, int r, int g, int b)
Image.Image Image.Image(int xsize, int ysize, int r, int g, int b, int alpha)
Image.Image Image.Image(int xsize, int ysize, string method, method ...)

Description

Initializes a new image object.

Image.Image
(XSIZE,YSIZE)
Image.Image
(XSIZE,YSIZE,255,128,0)

The image can also be calculated from some special methods, for convinience:

channel modes; followed by a number of 1-char-per-pixel strings
or image objects (where red channel will be used),
or an integer value:
  "grey" : make a grey image (needs 1 source: grey)
  "rgb"  : make an rgb image (needs 3 sources: red, green and blue)
  "cmyk" : make a rgb image from cmyk (cyan, magenta, yellow, black)
  "adjusted_cmyk" : make a rgb image from cmyk
           (cyan, magenta, yellow, black) where the colors aren't
           100% pure (C: 009ee0, M: e2007a, Y: ffec00, K: 1a171b).
  "raw"  : make an image from a binary string
 
generate modes; all extra arguments is given to the
generation function. These has the same name as the method:
  "<ref>test</ref>,"
  "<ref>gradients</ref>"
  "<ref>noise</ref>"
  "<ref>turbulence</ref>"
  "<ref>random</ref>"
  "<ref>randomgrey</ref>"
specials cases:
  "<ref>tuned_box</ref>" (coordinates is automatic)

Parameter image

Image to clone.

Parameter xsize
Parameter ysize

size of (new) image in pixels

Parameter color
Parameter r
Parameter g
Parameter b

background color (will also be current color), default color is black

Parameter alpha

default alpha channel value

Bugs

SIGSEGVS can be caused if the size is too big, due to unchecked overflow - (xsize*ysize)&MAXINT is small enough to allocate.

See also

copy, clone, Image.Image