Cutting out product image
Posted: Thu Apr 09, 2009 6:49 am
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hi there!
I have some product images with an single coloured background. I want to cut out the products. My very simple solution is this one:
The results are okay, but of course not the best. The products are tattered. Is there a way to improve this method? Is there somthing like a "Magic Stick" function where I can set the threshold for the TransparentColor?
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hi there!
I have some product images with an single coloured background. I want to cut out the products. My very simple solution is this one:
Code: Select all
$img = imagecreatefromjpeg($remote_img);
$bg_color = ImageColorAt ($img, 1, 1);
ImageColorTransparent($img, $bg_color);
imagepng($img, $img_path);
ImageDestroy($img);
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: