mirror of
https://github.com/Intervention/image.git
synced 2025-08-24 06:22:57 +02:00
Fix ignored opacity in Imagick's PlaceModifer for certain files. (#1346)
* Add tests to reproduce bug in PlaceModifier * Fix bug in PlaceModifier * Add tolerance parameter to BaseTestCase::assertColor()
This commit is contained in:
@@ -22,11 +22,19 @@ final class PlaceModifierTest extends GdTestCase
|
||||
$this->assertEquals('32250d', $image->pickColor(300, 25)->toHex());
|
||||
}
|
||||
|
||||
public function testColorChangeOpacity(): void
|
||||
public function testColorChangeOpacityPng(): void
|
||||
{
|
||||
$image = $this->readTestImage('test.jpg');
|
||||
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
||||
$image->modify(new PlaceModifier($this->getTestResourcePath('circle.png'), 'top-right', 0, 0, 50));
|
||||
$this->assertEquals('987028', $image->pickColor(300, 25)->toHex());
|
||||
}
|
||||
|
||||
public function testColorChangeOpacityJpeg(): void
|
||||
{
|
||||
$image = $this->createTestImage(16, 16)->fill('0000ff');
|
||||
$this->assertEquals('0000ff', $image->pickColor(10, 10)->toHex());
|
||||
$image->modify(new PlaceModifier($this->getTestResourcePath('exif.jpg'), opacity: 50));
|
||||
$this->assertColor(127, 83, 127, 255, $image->pickColor(10, 10), tolerance: 1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user