My script glues several images into one image but result image have single color dominated on first image from glue images set:
But input 4 images are in different colors (yellow, green, blue, red). Only first image from set is looks correct.
$images = array();
foreach ($fileNames as $fileName) {
$image = imagecreatefrompng($path . $fileName);
if ($image) {
$images[] = $image;
}
}
// ...
$img = imagecreate($w, $h);
$x = 0;
foreach ($images as $image) {
$width = imagesx($image);
$height = imagesy($image);
imagecopy($img, $image, $x, 0, 0, 0, $width, $height);
$x += $width;
}
Another one example (if first image from glue set is blue and other in differ colors):