Skip to content

Commit ae63639

Browse files
authored
Merge pull request #734 from ausi/fix/imagick-rotation
Fix IMagick rotation canvas size
2 parents 265c13b + 9cdfe29 commit ae63639

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Imagick/Image.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ public function rotate($angle, ColorInterface $background = null)
313313
$pixel = $this->getColor($background);
314314

315315
$this->imagick->rotateimage($pixel, $angle);
316+
$this->imagick->setImagePage(0, 0, 0, 0);
316317

317318
$pixel->clear();
318319
$pixel->destroy();

tests/tests/Image/AbstractImageTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,18 @@ public function testRotateWithTransparency()
219219
$this->assertSame(0, $color->getAlpha());
220220
}
221221

222+
public function testRotateWithCrop()
223+
{
224+
$palette = new RGB();
225+
$color = $this
226+
->getImagine()
227+
->create(new Box(100, 100), $palette->color('#f00'))
228+
->rotate(45, $palette->color('#fff'))
229+
->crop(new Point(0, 0), new Box(100, 100))
230+
->getColorAt(new Point(0, 50));
231+
$this->assertSame('#ffffff', (string) $color);
232+
}
233+
222234
/**
223235
* @doesNotPerformAssertions
224236
*/

0 commit comments

Comments
 (0)