Byron Posted December 2, 2011 Posted December 2, 2011 Wave an image with just a few lines of code using the Imagick Class (only on Stevie). This is the original image: http://byrondallas.heliohost.org/php/imagick/landscape.jpeg Here is the waved image: http://byrondallas.heliohost.org/php/imagick/wave.php Here's the code. You can use any color for the backgroundcolor. If you want the background to be transparent (like my example) you'll need to set the format to gif or png. <?php $image = new imagick("landscape.jpeg"); $image->setimagebackgroundcolor("transparent"); $image->waveImage(20, 240); $image->setImageFormat('png'); # uncomment line below to write image to directory # $image->writeimage("landscape_wav.png"); header("Content-Type: image/png"); echo $image; ?> You can play around with the amplitude and length, this line: $image->waveImage(20, 240); to get different wave patterns.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now