I speak a little English.
This is very good, it works:
<?php
header( 'Content-Type: image/png' );
$imgname = '../assets/images/lock-224x224.png'; // https://i.stack.imgur.com/9f6SL.png
$im = imagecreatefrompng( $imgname );
imagealphablending( $im, true );
imagesavealpha( $im, true );
imagefilter ( $im, IMG_FILTER_COLORIZE, rand( 0, 255 ), rand( 0, 255 ), rand( 0, 255 ) );
$im = imagerotate( $im, rand( 0, 360 ), 0 );
$im = imagescale( $im, -1, 224 );
imagepng( $im );
imagedestroy( $im );
?>
Source (transparent) [lock-224x224.png] image:
I would like transparency or colorized background, not black.
Now: black. Please see the created image: