imagecopymerge() function in PHP

The imagecopymerge() function copy and merge part of an image.

Syntax

imagecopymerge ( dst_img, src_img, dst_x, dst_y, src_x, src_y, src_w, src_h, pct )

Parameters

  • dst_im Set destination image link resource.

  • src_im Set source image link resource.

  • dst_x Set x-coordinate of destination point.

  • dst_y Set y-coordinate of destination point.

  • src_x Set x-coordinate of source point.

  • src_y Set y-coordinate of source point.

  • src_w Set source width.

  • src_h Set source height.

  • pct The two images will be merged according to pct which can range from 0 to 100.

Return

The imagecopymerge() function returns the TRUE on success or FALSE on failure.

Example

The following is an example:

Output

The following is the output displaying the merge of two images:

Example

Let us see another example wherein images are copied and merged with different coordinates:

Output

The following is the output:

Updated on: 2019-12-31T07:41:39+05:30

850 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements