Skip to content

Instantly share code, notes, and snippets.

@Deltachaos
Created May 8, 2012 14:42
Show Gist options
  • Save Deltachaos/2635721 to your computer and use it in GitHub Desktop.
Save Deltachaos/2635721 to your computer and use it in GitHub Desktop.
function testCompositeImage() {
echo "<h2>compositeImage</h2>";
$this->ImageMagickCanvas = new ImageMagickCanvasLib(400, 500, 'red');
//$this->ImageMagickCanvas->setBackgroundColor('red');
$this->ImageMagickCanvas->ellipse(10, 10, 100, 200);
$res = $this->ImageMagickCanvas->newLayer(130, 200, 'yellow');
$res->loadFromFile(dirname(__FILE__).DS.'imagick'.DS.'test.jpg');
$res->setPosition(350, 450);
$res->Brush('yellow');
//$res->text(1, 1, 'ABCDEF');
//$res->textImage('ABCDEF', 30);
//$res->crop(30, 40, 50, 60);
$res = $this->ImageMagickCanvas->newLayer(130, 200);
$res->setPosition(30, 30);
$res->loadFromFile(dirname(__FILE__).DS.'imagick'.DS.'test.jpg');
$res = $this->ImageMagickCanvas->newLayer(130, 200);
$res->setPosition(300, 400);
$res->setMode(imagick::COMPOSITE_BLEND);
$res->loadFromFile(dirname(__FILE__).DS.'imagick'.DS.'test.jpg');
$res->resize(40, 40);
//$this->ImageMagickCanvas->newLayer(30, 100);
$this->ImageMagickCanvas->Brush('green');
$this->ImageMagickCanvas->ellipse(30, 30, 400, 400);
$this->ImageMagickCanvas->Brush('black');
$this->ImageMagickCanvas->text(140, 330, 'ABCDEF', 30);
//$this->ImageMagickCanvas->text(340, 430, 'ABCDEF');
$ImageMagickCanvas = new ImageMagickCanvasLib();
$ImageMagickCanvas->loadFromString($this->ImageMagickCanvas->getImage('png'));
$ImageMagickCanvas->resize(140, 140);
$img = $ImageMagickCanvas->getImage('png')
$this->ImageMagickCanvas->flattenImages();
$this->ImageMagickCanvas->Imagick->setResolution(15, 15);
$is = $this->ImageMagickCanvas->saveToFile(TMP.'x.jpg', 'jpg');
$this->assertTrue($is);
//$this->ImageMagickCanvas->flattenImages();
$this->_echoImg();
//$this->ImageMagickCanvas2 = new ImageMagickCanvasLib(50, 200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment