Skip to main content

Merge two images

Merge transformation allows users to add layers and merge images. The user can overlay, underlay or wrap and merge the images as per the user’s requirements. The user can also add a background color instead of an image. The parameters will help to control how the second image is positioned on your base image, and how they blend.

The user can use this transformation to add logos, watermarks and signatures and more to your images. This can also be used to hide or censor parts of your images. Merging two images also helps you to combine two or more images into a single image.


Params

Mode (m)

Sets the order of merging.

Valid values are overlay, underlay and wrap. The overlay is the default value.

Underlay is an image that is added under a semi-transparent base image and overlay is an image that is added to the top of your image.

Both overlay and wrap will lay one image over another, but overlay can only work with a single rectangular box, while wrap can be used with multiple rectangular boxes or polygons.

Image (i)

Unique Id of the composite image.

Select an image you want to add to your base image from the Playground of PixelBin.

Background (bg)

The background color is to be merged with the base image.

Instead of merging with another image, you can merge your base image with a background color.

Height (h), Width (w)

This option is only available when you are adding a background. This option will help you to adjust the size of the background.

These parameters will only work for underlay and overlay modes.

Top (t), Left (l)

This option is only available when you are adding a background. This option will help you to adjust the size of the background.

These parameters will only work for underlay and overlay modes.

Gravity (g)

Specifies the position of the overlay image.

Valid values are northwest, north, northeast, east, center, west, southwest, south, southeast and custom. The default is center.

This parameter will only work for underlay and overlay modes.

Blend (b)

How to blend the two layers.

The default value is over.

This parameter will only work for underlay and overlay modes.

Open to view the Blend options
OptionDescription
overPlaces the overlay image on top of the base image.
inThe base image is removed completely. The overlay image appears exactly where the base and overlay image overlapped previously.
outBoth images are removed from the screen.
atopPlaces the overlay image on top of the base image.
destShows the base image while the overlay image is completely removed.
dest-overThe output here is similar to the over output except that the base image is placed on the overlay image.
dest-iThe overlay image is removed and the base image is now visible in the previously overlapped area.
dest-outThe overlay image is removed. The base image can be seen on the screen but both images are removed from the overlapping area.
dest-atopPlaces the base image on top of the overlay image.
xorOnly the base image is visible, however, it's not drawn over the overlapping areas.
addBoth images are available however the overlapping area is covered with the combination of their colours.
saturateThe base image saturates the screen completely so that the overlay is no longer visible.
multiplyThe resulting output is a dark coloured version of the darker colour (either overlay or base image colours).
screenThe resulting output is a light coloured version of the lighter colour (either overlay or base image colours).
overlayBlends both colours and gives a darker version of the base image.
darkenBlends both colours depending on the darkness of the base image.
lightenBlends both colours depending on the lightness of the base image.
colour-dodgeBrightens the base image colour.
colour-burnDarkens the base image colour.
hard lightMultiplies both colours together depending on the lightness of the overlay image.
soft lightMultiplies both colours together depending on the lightness of the base image.
differenceTakes the difference of overlay and base image colours.
exclusionSimilar to the output of difference but with less contrast.

Tile (r)

Repeat tile.

This boolean parameter repeats the overlay image like tiles over the image being processed. The default value is false.

This parameter will only work for underlay and overlay modes.

List of bboxes (bboxes)

It is similar to the top, left, height, width parameters. Just, instead of individual values, you can pass a list of n such values.

The value must be a list of bboxes, where a bbox should be of the form: [top_left_height_width].

For instance, if you have a single box, then it will be [[top_left_height_width]] for two boxes it will be [[top_left_height_width]_[top_left_height_width]], etc.

This parameter will only work for wrap mode.

List of polygons (polys)

A list of polygons to allow you to map n number of polygonal structures. A polygon allows you to pass a list of x and y coordinates. Each polygon must have only 4 coordinates.

The value must be a list of polygons, where a polygon should be of the form: [[x1_y1]_[x2_y2]_[x3_y3]_[x4_y4]].

For instance, if you have a single polygon, then it will be [[[x1_y1]_[x2_y2]_[x3_y3]_[x4_y4]]] for two polygons it will be [[[x1_y1]_[x2_y2]_[x3_y3]_[x4_y4]]_[[x1_y1]_[x2_y2]_[x3_y3]_[x4_y4]]], etc.

This parameter will only work for wrap mode.


Wrap mode

Wrap mode allows users to overlay one image over another at multiple locations. User can either select rectangle boxes or polygons of varied shapes.

Only image (i), background (bg), bboxes and polys parameters can be used with wrap mode.

Either bboxes or polys parameter is needed. Priority will be given to the bboxes parameter if both bboxes and polys are passed.

Transform and enhance your images using our powerful AI technology. Organize your images in more efficient manner and our extensible APIs enables seamless integration with your system unleashing the power of our platform. Join the large community of users who use PixelBin to transform their image libraries and achieve excellent performance

Is this page useful?