导航菜单
首页 >  image  > Image Module

Image Module

Pastes another image into this image. The box argument is eithera 2-tuple giving the upper left corner, a 4-tuple defining theleft, upper, right, and lower pixel coordinate, or None (same as(0, 0)). See Coordinate System. If a 4-tuple is given, the sizeof the pasted image must match the size of the region.

If the modes don’t match, the pasted image is converted to the mode ofthis image (see the convert() method fordetails).

Instead of an image, the source can be a integer or tuplecontaining pixel values. The method then fills the regionwith the given color. When creating RGB images, you canalso use color strings as supported by the ImageColor module.

If a mask is given, this method updates only the regionsindicated by the mask. You can use either “1”, “L”, “LA”, “RGBA”or “RGBa” images (if present, the alpha band is used as mask).Where the mask is 255, the given image is copied as is. Wherethe mask is 0, the current value is preserved. Intermediatevalues will mix the two images together, including their alphachannels if they have them.

See alpha_composite() if you want tocombine images with respect to their alpha channels.

Parameters:

im – Source image or pixel value (integer, float or tuple).

box –

An optional 4-tuple giving the region to paste into.If a 2-tuple is used instead, it’s treated as the upper leftcorner. If omitted or None, the source is pasted into theupper left corner.

If an image is given as the second argument and there is nothird, the box defaults to (0, 0), and the second argumentis interpreted as a mask image.

mask – An optional mask image.

相关推荐: