http://qs321.pair.com?node_id=11132677


in reply to Re^2: GD colorAllocate not changing colour
in thread GD colorAllocate not changing colour

The problem may be here

$image->copy($resize, 0, 0, 0, ($newh - 450) / 2, 600, 450);

gd does nice cropping to viewports but this one may be too much if $newh<450

if ($newh<450) { $image->copy($resize, 0, (450-$newh ) / 2, 0,0, 600, $newh); } else { $image->copy($resize, 0, 0, 0, ($newh - 450) / 2, 600, 450); ]

Trying to copy from outside the bounds of the src image may have introduced the black, just a guess

Replies are listed 'Best First'.
Re^4: GD colorAllocate not changing colour
by Bod (Parson) on May 21, 2021 at 21:20 UTC
    Trying to copy from outside the bounds of the src image may have introduced the black, just a guess

    If that was just a guess, it was a very good guess...
    Although I suspect it was an educated guess at the very least :)

    Either way, that has worked!
    Thank you very much huck.

    Because the problem was only appearing with a real picture as the image and not a pattern created in GD, it seemed to be a palette issue. The effort had been looking there rather than the way the foreground image is placed on the background...