r/PHPhelp • u/DoctorLeopard • Jan 14 '26
Best way to color change an image with any rbg color while maintaining soft edges
The goal:
Take an image drawn in grey, which can vary in shape and size, and change the grey to any rgb color I want by inputting the hex code.
What I've tried:
- imagefilter with IMG_FILTER_Colorize. This doesn't work because it blends the color I input with the starting color of the image. In this case the results are too light.
- imagefill, which does not work with images that have smooth or blended edges though it does apply the right color. it's also very tedious locating and listing the function for every area of color.
Both of these are close, but not quite right. I need one I can apply to an entire layer that gives the layer the color I put in without tinting it, but that also respects fading and blended edges.