PHP imagecopymergegray() Function (original) (raw)

Last Updated : 11 Jul, 2025

The imagecopymergegray() function is an inbuilt function in PHP that is used to copy and merge the part of an image with a grayscale. This function copies the part of the source image into the destination image. This function returns true on success or false on failure.

Syntax:

bool imagecopymergegray ( dstimage,dst_image, dstimage,src_image, dstx,dst_x, dstx,dst_y, srcx,src_x, srcx,src_y, srcw,src_w, srcw,src_h, $pct )

parameters: This function accepts nine parameters as mentioned above and described below:

Return Value: This function returns true on success or false on failure. The below programs illustrate the imagecopymergegray() function in PHP.

Program 1:

php `

`

Output:

image

Program 2:

php `

`

Output:

image

Related Articles:

Reference: https://www.php.net/manual/en/function.imagecopymergegray.php