Pure PHP won't work. The required minimum is the standard PHP extension GD . It is possible that it is already activated.
First of all, you will need to create an image in PHP memory; for this, numerous functions of the imagecreate* family are provided. For example, create from a png file:
$image = imagecreatefrompng('путь к файлу.png');
The imagecolorat function will help determine the color and transparency of a pixel (for convenience, you can additionally apply imagecolorsforindex ). From the documentation:
Result:
array(4) { ["red"]=> int(119) ["green"]=> int(123) ["blue"]=> int(180) ["alpha"]=> int(127) }
To set a pixel on an image, use the imagesetpixel function, its signature:
bool imagesetpixel ( resource $image , int $x , int $y , int $color )
Here in the previously created image to the point with coordinates $x , $y pixel is displayed with the color $color , which must also be created.
To get the color with the alpha channel, use the imagecolorallocatealpha function, its signature:
int imagecolorallocatealpha ( resource $image , int $red , int $green , int $blue , int $alpha )
I propose to study the materials on the links, then independently write the script you need is not difficult.