mirror of
https://github.com/Intervention/image.git
synced 2025-08-18 19:51:22 +02:00
Fix edge case in CropModifier
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||
|
||||
use ImagickDraw;
|
||||
use ImagickPixel;
|
||||
use Intervention\Image\Drivers\DriverSpecializedModifier;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\SizeInterface;
|
||||
@@ -23,10 +24,15 @@ class CropModifier extends DriverSpecializedModifier
|
||||
$this->driver()->handleInput($this->background)
|
||||
);
|
||||
|
||||
$transparent = new ImagickPixel('transparent');
|
||||
|
||||
$draw = new ImagickDraw();
|
||||
$draw->setFillColor($background);
|
||||
|
||||
foreach ($image as $frame) {
|
||||
$frame->native()->setBackgroundColor($transparent);
|
||||
$frame->native()->setImageBackgroundColor($transparent);
|
||||
|
||||
// crop image
|
||||
$frame->native()->extentImage(
|
||||
$crop->width(),
|
||||
|
@@ -53,10 +53,10 @@ class ImageTest extends TestCase
|
||||
$this->assertEquals(4, $result->width());
|
||||
|
||||
$this->assertEquals('ff0000', $image->pickColor(0, 0)->toHex());
|
||||
$this->assertEquals('00000000', $image->pickColor(1, 0)->toHex());
|
||||
$this->assertTransparency($image->pickColor(1, 0));
|
||||
|
||||
$this->assertEquals('ff0000', $clone->pickColor(0, 0)->toHex());
|
||||
$this->assertEquals('00000000', $clone->pickColor(1, 0)->toHex());
|
||||
$this->assertTransparency($clone->pickColor(1, 0));
|
||||
}
|
||||
|
||||
public function testDriver(): void
|
||||
|
Reference in New Issue
Block a user