how to use the top composed img size as the result img size?
Posted: 2011-02-15T00:03:10-07:00
source pattern image:
description:
my code:
1,use pure color to be background;
2,top img is the pattern.png ,use "-compose overlay" method;
can my code be any shorter? it seems a little long. any option using the top image's width and height as the composed img's?
description:
my code:
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 " .
"page.png";
exec($cmd);
echo "<img src='pattern.png'/>";
echo "<br><br>";
echo "<img src='page.png'/>";
?>
2,top img is the pattern.png ,use "-compose overlay" method;
can my code be any shorter? it seems a little long. any option using the top image's width and height as the composed img's?