Skip to content

Commit

Permalink
Merge pull request #20 from JeffAlyanak/new-command-monochrome
Browse files Browse the repository at this point in the history
Added monochrome Command
  • Loading branch information
Pierstoval authored Jan 1, 2020
2 parents f97555b + d85482d commit 7f7a0d7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,17 @@ public function strip(): self
return $this;
}


/**
* @see http://imagemagick.org/script/command-line-options.php#monochrome
*/
public function monochrome(): self
{
$this->command[] = '-monochrome';

return $this;
}

/**
* @see http://imagemagick.org/script/command-line-options.php#interlace
*/
Expand Down
19 changes: 19 additions & 0 deletions Tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,25 @@ public function testColorspaceImage(): void
$this->testConvertIdentifyImage($imageOutput, 'JPEG', '180x170+0+0', '8-bit');
}

public function testMonochrome(): void
{
$command = new Command(IMAGEMAGICK_DIR);

$imageSource = $this->resourcesDir.'/moon_180.jpg';
$imageOutput = $this->resourcesDir.'/outputs/moon_monochrome.jpg';
static::assertFileExists($imageSource);

$response = $command
->convert($imageSource)
->monochrome()
->file($imageOutput, false)
->run()
;

static::assertFalse($response->hasFailed());
static::assertFileExists($this->resourcesDir.'/outputs/moon_monochrome.jpg');
}

public function testGravityCommand(): void
{
$command = new Command(IMAGEMAGICK_DIR);
Expand Down

0 comments on commit 7f7a0d7

Please sign in to comment.