How to replace a background of white color with php

enter image description here

  • one
    Are you sure that you need php for this? - Cheg

1 answer 1

You need GD or Imagic.

GD example: http://php.net/manual/ru/book.image.php

$im = imagecreatefromgif("test.gif"); // Так же есть функции для чтения других форматов $index = imagecolorclosest($im, 255, 255, 255); // Получить всё что белое imagecolorset($im, $index, 92, 92, 92); // Меняем белое на серое. imagegif($im, "result.gif"); // Сохраняем картинку imagedestroy($im); 
  • Someone put a minus - do not want to explain what is wrong? The answer is correct. Added a plus on my own. - AK