Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between 'imagecopy()' and 'imagecopymerge()'? [closed]

Tags:

php

gd

What is the difference between these 2 functions from the PHP GD library?

like image 292
Andrei Oniga Avatar asked Nov 22 '12 09:11

Andrei Oniga


1 Answers

These two functions are both quite similar in that they copy one picture into another.

The way these functions differ is in the last parameter: imagecopy() always overwrites all the pixels in the destination with those of the source, whereas imagecopymerge() merges the destination pixels with the source pixels by the amount specified in the extra parameter:

0 means "keep the source picture fully", 
100 means "overwrite with the source picture fully", 
and 50 means "mix the source and destination pixel colours equally". 

The imagecopy() function is therefore equivalent to calling imagecopymerge() and passing in 100 as the last parameter.

like image 57
bipen Avatar answered Sep 22 '22 10:09

bipen