Page 1 of 1

how to build a center black gradient?

Posted: 2011-02-15T02:17:35-07:00
by linjuming
Image

Re: how to build a center black gradient?

Posted: 2011-02-15T02:23:39-07:00
by linjuming
Image


pattern.png:
Image

Code: Select all

<?php


$gb_pattern="pattern.png ";
$im=new imagick($gb_pattern);
$pattern_geo=$im->getimagegeometry();
$width=$pattern_geo["width"];
$height=$pattern_geo["height"];

$cmd =	"convert " .
		"-size {$width}x$height xc:#D18521 " .
		"( tile:$gb_pattern  -alpha set -channel A -evaluate set 50% ) -compose overlay -composite " .
		"( gradient:black-#808080-black -alpha set -channel A -evaluate set 80% -gravity north ) -compose overlay -composite " .
		"page.png";

exec($cmd);

echo "<img src='pattern.png'/>";
echo "<br><br>";
echo "<img src='page.png'/>";



?>

Re: how to build a center black gradient?

Posted: 2011-02-15T10:13:34-07:00
by fmw42
convert -size 20x256 gradient: -rotate 90 -solarize 50% -level 0,50% -negate tmp1.png

or for less contrast

convert -size 20x256 gradient: -rotate 90 -solarize 50% -level 0,50% -negate +level 0,75% tmp2.png

see http://www.imagemagick.org/Usage/color_mods/#solarize and http://www.imagemagick.org/Usage/color_mods/#level


alternately

convert \( -size 20x128 gradient:"gray(25%)-gray(50%)" -rotate 90 \) \( +clone -flop \) +append tmp3.png


Note the center pixel will be duplicated in these cases. If you don't want that, then you need to use -shave or -chop. See http://www.imagemagick.org/Usage/crop/

Re: how to build a center black gradient?

Posted: 2011-02-15T20:10:04-07:00
by linjuming
very nice example ,thank you very much

Re: how to build a center black gradient?

Posted: 2011-02-15T20:17:34-07:00
by anthony
Do you want a 'sharp' center or a smooth center?

See IM Examples,canvas creation, gradients
http://www.imagemagick.org/Usage/canvas/#gradient

also look at the gradient created for a 'tile-shift' photo effect
http://www.imagemagick.org/Usage/photos/#tilt_shift