Skip to content

Commit

Permalink
Merge pull request #6210 from caplod/feature/imagemagick-thread
Browse files Browse the repository at this point in the history
Add option to change number of threads for imagemagick convert
  • Loading branch information
bastianallgeier authored Feb 1, 2024
2 parents 5c46047 + 98dbc5e commit 589e5bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Image/Darkroom/ImageMagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ protected function convert(string $file, array $options): string
{
$command = escapeshellarg($options['bin']);

// limit to single-threading to keep CPU usage sane
$command .= ' -limit thread 1';
// default is limiting to single-threading to keep CPU usage sane
$command .= ' -limit thread ' . escapeshellarg($options['threads']);

// append input file
return $command . ' ' . escapeshellarg($file);
Expand All @@ -77,6 +77,7 @@ protected function defaults(): array
return parent::defaults() + [
'bin' => 'convert',
'interlace' => false,
'threads' => 1,
];
}

Expand Down
1 change: 1 addition & 0 deletions tests/Image/Darkroom/ImageMagickTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testProcess()
'width' => 500,
'bin' => 'convert',
'interlace' => false,
'threads' => 1,
'sourceWidth' => 500,
'sourceHeight' => 500
], $im->process($file));
Expand Down

0 comments on commit 589e5bf

Please sign in to comment.