Online T-shirt Printing - Remove White Image from Image Upload

Some background information: I'm basically looking to re-create an image upload to tshirt. This was successful as long as I don't need to remove the white color from the uploaded images in order to remove the background color. Flash is not an option to fear, a script upload facility is written in PHP along with using jQuery drag to move and resize images and a test on the shirt.

A good example can be found at http://www.zazzle.co.uk , where the "show white in image as transparent" option is available if you click on Advanced options. I would like to emulate this function, but I am having problems with it.

Any help would be great, just a point in the right direction? I looked at using Jquery, PHP, ImageMagick but to no avail ...

+3


source to share


2 answers


ImageMagick can do this. Not sure why you're out of luck with this.

ImageMagick command example:



convert input.gif -transparent white output.gif

      

However, this will only work for a pure white image. Not if it is slightly white.

+1


source


At http://www.html5canvastutorials.com/advanced/html5-canvas-invert-image-colors-tutorial/ and http://www.w3schools.com/tags/canvas_getimagedata.asp you can take a look at some image manipulation in JavaScript. You can use this as a basis for your own procedures.



What you do is check if it is white (RGB = FF, FF, FF) and then set alpha transparency (alpha = FF). You can also do even more complex processing.

0


source







All Articles