Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
gdImageCrop neglecting transparency? #432
According to https://github.com/libgd/libgd/blob/master/src/gd_crop.c#L53 gdImageCreateTrueColor is being called which, as stated here https://github.com/libgd/libgd/blob/master/src/gd.c#L264 will always be filled with black by default.
So the destination image of gdImageCrop is filled with black by default. When gdImageCopy is called to crop the source onto the destination, it nicely blends the source color onto the destination since, quote: "alpha blending is now on by default". As per https://github.com/libgd/libgd/blob/master/src/gd.c#L341. And programatically you're unable to modify the destination (i.e. cropped image) before the source is copied upon it.
So the solution would be, as far as my knowledge of C goes, which is effectively very little, to be honest, to set the alphaBlendingFlag of the destination image for gdImageCrop to
Issue in node-gd repo: y-a-v-a/node-gd#60
@pierrejoye Is there any particular reason why the implementations differ so much? Which implementation would be preferable?
PS: Solved with php/php-src@b309f64