change image background
Posted: 2018-09-29T02:38:01-07:00
Hi
I am using image magic command to convert the image background :
exec("convert test.JPG -resize 500x500 -quality 100 demo.png");
exec("convert demo.png \( +clone -fx 'p{10,10}' \) -compose Difference -composite -modulate 100,0 -alpha off difference.png");
exec("convert difference.png -bordercolor black -border 0 -threshold 15% -blur 0x3 -sharpen 0x10 halo_mask.png");
exec("convert demo.png -bordercolor white -border 0 halo_mask.png -alpha Off -compose CopyOpacity -composite test_halo.png");
converted image
converted image quality is not good and it also not make whole background white
Expected image :
Anybody please help me to found the expected solution.
I am using image magic command to convert the image background :
exec("convert test.JPG -resize 500x500 -quality 100 demo.png");
exec("convert demo.png \( +clone -fx 'p{10,10}' \) -compose Difference -composite -modulate 100,0 -alpha off difference.png");
exec("convert difference.png -bordercolor black -border 0 -threshold 15% -blur 0x3 -sharpen 0x10 halo_mask.png");
exec("convert demo.png -bordercolor white -border 0 halo_mask.png -alpha Off -compose CopyOpacity -composite test_halo.png");
converted image
converted image quality is not good and it also not make whole background white
Expected image :
Anybody please help me to found the expected solution.