Hi All,
I would like to know how to avoid the default black background color in ImageCopyResampled if origin and destination do not fit.
ImageCopyResampled puts always a black background and if I try to fill it with another color and with ImageFill function, ... I get problems: Some images with a deep dark colors predominance or even with a deep light color predominance too, are filled with my color, as you know, applied with ImageFill.
Here is some example code:
$im = ImageCreateTrueColor($nx, $ny);
ImageInterlace($im, 1);
ImageCopyResampled($im, $im2, 0, 0, $ox, $oy, $nx, $ny, $nx, $ny);
ImageFill($im, 0, 0, ImageColorAllocate($im, 191, 225, 216));
What do you think? I spent two days doing many combinations, and using other options like ImageColorClosest, ImageAlphaBlending, ImageColorTransparent. I couldn't get anything. Maybe I didn't use these functions rightly. I guess.
If I use ImageFill before ImageCopyResampled, I get the same result, ImageCopyResampled puts its black background, if on contrary, as I mentioned, there are problems with darken and lighten images.
I know that ImageCreateTrueColor default color is black too, but setting another color with ImageFill or ImageColorTransparent before ImageCopyResampled doesn't work because looks like ImageCopyResampled puts another ImageCreateTrueColor and its black color at top of image.
ImageInterlace is not relevant for the problem, I have researched this too.
I am desperate, indeed.
Mapg