![Image](http://i532.photobucket.com/albums/ee323/linjuming/questions/center_gradient.png)
how to build a center black gradient?
Re: how to build a center black gradient?
![Image](http://i532.photobucket.com/albums/ee323/linjuming/questions/center_gradient_2.png)
pattern.png:
![Image](http://i532.photobucket.com/albums/ee323/linjuming/questions/pattern.png)
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'/>";
?>
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to build a center black gradient?
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/
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?
very nice example ,thank you very much
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: how to build a center black gradient?
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
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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/