Hi,
How do you convert an image to black and white in PHP.I see this in one site and is a great future to any site.
Thanks
djr33
09-26-2009, 02:11 AM
You can use the GD library.
http://www.php.net/manual/en/function.imagefilter.php
See "IMG_FILTER_GRAYSCALE"
Be warned, though, that it may be slow especially on larger pictures. If there is a way you can batch pre-process your images first that will save you server difficulties (slow images, stressed processor), or you could save them when they are converted the first time (check if it's saved, if not, convert and store, but then only do it once).
There's also the option of image magick, though I'm not sure how you'd do it with that. (It's basically an alternative to GD, though it has its own problems, and isn't bundled by default.)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.