Hi all,
Im desperatly trying to find a solution to removing the colour black from an image(the backfround is black with a white object in front) . I have tried image masking but no succses. Im currently using the -transparent command...and was hoping if someone could have a quick look at the code to see where im going wrong...(no image is been displayed)
<?php
// If the form has been submitted do this
if ( $Submit ) {
// Temporary upload image name
$original_image = $_FILES['all.jpg']['all.jpg'];
// Name to save the image as - in this case the same as the original
$new_image = $_FILES['all.jpg']['all.jpg'];
//command to remove the background
$cmd = " $filename -transparent black ";
// $new_Iimage is the output_filename
exec(" convert $cmd $new_image ");");
echo "File uploaded<br>";
echo "<img src=\"".$new_image."\">";
}
else { ?>
<p>File to upload:</p>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<input type="file" name="filename" />
<input type="Submit" name="Submit" value="Submit" />
</form>
<?php } ?>
Any suggestions where im going wrong...id really appreciate any help..so thanks to anyone who might know and can help!!!
Kind Rgrds,
Mary
Background Removal command
Re: Background Removal command
You have a problem here:
Try echoing some of your variables to confirm they contain what you expect.
You will probably still have a black background anyway as jpg does not support transparancy.
Code: Select all
$new_image = $_FILES['all.jpg']['all.jpg'];
You will probably still have a black background anyway as jpg does not support transparancy.