Black and White Effect
Posted: 2012-07-10T08:22:42-07:00
How to do this effect?
Give me some clues.

Give me some clues.

Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://download.imagemagick.org/discourse-server/
https://download.imagemagick.org/discourse-server/viewtopic.php?t=21402
Code: Select all
<?php
// Create a image 2px wide and 4px high. Colour the top 2px wide and 1px high black
exec("convert -size 2x4 xc:none -fill black -draw \"rectangle 0,0 2,1\" tile.png");
// Lay the black and white stripped image over the main image adjusting the opacity to create the desired effect
exec("composite -dissolve 30% -tile tile.png sunflower.jpg blinds.jpg");
// Delete the tempory files
unlink("tile.png");
/*
An improved method without any tempory images.
This uses the imagemagick miff:- which saves the image into the memory and then the Unix | "pipe".
This uses the image created in the first part of the code in the second part of the code.
*/
$cmd = "-size 2x4 xc:none -fill black -draw \"rectangle 0,0 2,1\" miff:- | ".
" composite -dissolve 30% -tile - sunflower.jpg ";
exec("convert $cmd blinds.jpg");
?>