I am currently working on a PHP script to build a coloring book. User will upload the images(colored) and I've convert those images into colorless images(Color-able) and arrange them in a PDF file. Everything is managed but I am not able to convert image into the color-able image. Image show have white background and black strokes.
Currently I am using this code:
$im = imagecreatefromjpeg($_FILES['image']['tmp_name'][$i]);
/* R, G, B, so 0, 255, 0 is green */
if ($im) {
imagefilter($im, IMG_FILTER_GRAYSCALE);
imagefilter($im, IMG_FILTER_EDGEDETECT);
imagefilter($im, IMG_FILTER_MEAN_REMOVAL);
imagefilter($im, IMG_FILTER_CONTRAST, -1000);
imagejpeg($im, "tmp_image/image-".$i.".jpg");
$pdf_images[] = "tmp_image/image-".$i.".jpg";
imagedestroy($im);
}
For example:
Color Image
to
Color-able Image
Thank you for the help.
I tried the PHP GDLib Edge Detection filter but couldn't get the required result.


$im = imagecreatefromjpeg($_FILES['image']['tmp_name'][$i]); /* R, G, B, so 0, 255, 0 is green */ if($im) { imagefilter($im, IMG_FILTER_GRAYSCALE); imagefilter($im, IMG_FILTER_EDGEDETECT); imagefilter($im, IMG_FILTER_MEAN_REMOVAL); imagefilter($im, IMG_FILTER_CONTRAST, -1000); imagejpeg($im, "tmp_image/image-".$i.".jpg"); $pdf_images[] = "tmp_image/image-".$i.".jpg"; imagedestroy($im); }- muhammad Aqib Rasheed