# Module PIL.ImageChops

#### Module Summary:

    def add(image1, image2, scale=1.0, offset=0)

> Add images ((image1 + image2) / scale + offset).

    def add_modulo(image1, image2)

> Add images without clipping ((image1 + image2) % MAX).

    def blend(image1, image2, alpha)

> Blend images using constant transparency weight.

    def composite(image1, image2, mask)

> Create composite using transparency mask.

    def constant(image, value)

> Return an image with the same size as the given image, but filled with the given pixel value.

    def darker(image1, image2)

> Compare images, and return darker pixel value (min(image1, image2)).

    def difference(image1, image2)

> Calculate absolute difference (abs(image1 - image2)).

    def duplicate(image)

> Copy image.

    def invert(image)

> Inverts an image (MAX - image).

    def lighter(image1, image2)

> Compare images, and return lighter pixel value (max(image1, image2)).

    def logical_and(image1, image2)

> Logical AND (image1 and image2).

    def logical_or(image1, image2)

> Logical OR (image1 or image2).

    def logical_xor(image1, image2)

> Logical XOR (image1 xor image2).

    def multiply(image1, image2)

> Superimpose positive images (image1 * image2 / MAX).

    def offset(image, xoffset, yoffset=None)

> Offset image data.

    def screen(image1, image2)

> Superimpose negative images (MAX - ((MAX - image1) * (MAX - image2) / MAX)).

    def subtract(image1, image2, scale=1.0, offset=0)

> Subtract images ((image1 - image2) / scale + offset).

    def subtract_modulo(image1, image2)

> Subtract images without clipping ((image1 - image2) % MAX).

## Functions

### add

    add(image1, image2, scale=1.0, offset=0)

Add images ((image1 + image2) / scale + offset).

Adds two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.

### add_modulo

    add_modulo(image1, image2)

Add images without clipping ((image1 + image2) % MAX).

Adds two images, without clipping the result.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.

### blend

    blend(image1, image2, alpha)

Blend images using constant transparency weight.

Same as the blend function in the Image module.

### composite

    composite(image1, image2, mask)

Create composite using transparency mask.

Same as the composite function in the Image module.

### constant

    constant(image, value)

Return an image with the same size as the given image, but filled with the given pixel value.

#### Parameters:

`image` -- Reference image.

`value` -- Pixel value.

#### Returns:

An image object.

### darker

    darker(image1, image2)

Compare images, and return darker pixel value (min(image1, image2)).

Compares the two images, pixel by pixel, and returns a new image containing the darker values.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.

### difference

    difference(image1, image2)

Calculate absolute difference (abs(image1 - image2)).

Returns the absolute value of the difference between the two images.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.

### duplicate

    duplicate(image)

Copy image.

#### Parameters:

`image` -- Source image.

#### Returns:

A copy of the source image.

### invert

    invert(image)

Inverts an image (MAX - image).

#### Parameters:

`image` -- Source image.

#### Returns:

An image object.

### lighter

    lighter(image1, image2)

Compare images, and return lighter pixel value (max(image1, image2)).

Compares the two images, pixel by pixel, and returns a new image containing the lighter values.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.

### logical_and

    logical_and(image1, image2)

Logical AND (image1 and image2).

### logical_or

    logical_or(image1, image2)

Logical OR (image1 or image2).

### logical_xor

    logical_xor(image1, image2)

Logical XOR (image1 xor image2).

### multiply

    multiply(image1, image2)

Superimpose positive images (image1 * image2 / MAX).

Superimposes two images on top of each other. If you multiply an image with a solid black image, the result is black. If you multiply with a solid white image, the image is unaffected.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.

### offset

    offset(image, xoffset, yoffset=None)

Offset image data.

Returns a copy of the image where data has been offset by the given distances. Data wraps around the edges. If yoffset is omitted, it is assumed to be equal to xoffset.

#### Parameters:

`image` -- Source image.

`xoffset` -- The horizontal distance.

`yoffset` -- The vertical distance. If omitted, both distances are set to the same value.

#### Returns:

An Image object.

### screen

    screen(image1, image2)

Superimpose negative images (MAX - ((MAX - image1) * (MAX - image2) / MAX)).

Superimposes two inverted images on top of each other.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.

### subtract

    subtract(image1, image2, scale=1.0, offset=0)

Subtract images ((image1 - image2) / scale + offset).

Subtracts two images, dividing the result by scale and adding the offset. If omitted, scale defaults to 1.0, and offset to 0.0.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.

### subtract_modulo

    subtract_modulo(image1, image2)

Subtract images without clipping ((image1 - image2) % MAX).

Subtracts two images, without clipping the result.

#### Parameters:

`image1` -- First image.

`image1` -- Second image.

#### Returns:

An image object.