Hi all,
Have just come across this amazing piece of software and am currently looking to set up a site whereby an uploaded image with a solid background colour can be removed. Its basically for users to upload an image of clothing , remove background(or make it transparent) and than try it on a model. Would anyone know if this is possible...am hoping tha it can be done automatically...big ask i know ......also could anyone direct me to a site where this software is in action so I can have a look?
Thanks a million...any info would be very greatly appricated!!!!
Marzmurphy
ImageMagic Examples
Re: ImageMagic Examples
It can be done but you do not want any of the colour in the clothes.
You can add resizing etc. as well if you need to.
An example of an upload form - in this case resizing:
Code: Select all
<?php
$filename = "The name of the image from the upload form";
$cmd = " $filename -transparent the_colour ";
exec(" convert $cmd output_filename_and_path ");
?>
An example of an upload form - in this case resizing:
Code: Select all
<?php
// If the form has been submitted do this
if ( $Submit ) {
// Temporary upload image name
$original_image = $_FILES['filename']['tmp_name'];
// Get the image dimensions
$size=GetImageSize( $original_image );
// Name to save the image as - in this case the same as the original
$new_image = $_FILES['filename']['name'];
// Maximum image width
$max_width = "200";
// Maximum image height
$max_height = "90";
// Resize the image and save
exec("convert -size {$size[0]}x{$size[1]} $original_image -thumbnail $max_widthx$max_height $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 } ?>
Re: ImageMagic Examples
Hi,
Thanks for the reply...looks like this will work but like you said will have to make sure their is no other colour in the clothes.........have you any idea how compatible this would be using Drupal...as far as I can see imagemagic can be used with the CMS??
Thanks for your help!!!
Marz
Thanks for the reply...looks like this will work but like you said will have to make sure their is no other colour in the clothes.........have you any idea how compatible this would be using Drupal...as far as I can see imagemagic can be used with the CMS??
Thanks for your help!!!
Marz