Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: GD colorAllocate not changing colour

by huck (Prior)
on May 16, 2021 at 21:34 UTC ( [id://11132677]=note: print w/replies, xml ) Need Help??


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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132677]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found