Skip to content

Commit 63c7785

Browse files
author
Jakub Caban
committed
Make PixelateCommand actually pixelate and retain image size
1 parent 02ed15b commit 63c7785

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Commands/PixelateCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Intervention\Image\Vips\Commands;
66

77
use Jcupitt\Vips\Image;
8+
use Jcupitt\Vips\Kernel;
89

910
class PixelateCommand extends AbstractCommand
1011
{
@@ -23,7 +24,9 @@ function () use ($image, $size) {
2324
/** @var Image $core */
2425
$core = $image->getCore();
2526

26-
$core = $core->resize(1 / $size)->resize($size);
27+
$core = $core->resize(1 / $size)
28+
->resize($size, ['kernel' => Kernel::NEAREST])
29+
->crop(0, 0, $image->width(), $image->height());
2730

2831
$image->setCore($core);
2932
}

0 commit comments

Comments
 (0)