From 48f8939f743124ba01d3a2ca3efaf5ece693568a Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 28 Sep 2023 08:54:51 +0200 Subject: [PATCH] wip #6300 @0.25 --- src/CommandLine/Imagemagick.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/CommandLine/Imagemagick.php b/src/CommandLine/Imagemagick.php index ec1090d..4096229 100644 --- a/src/CommandLine/Imagemagick.php +++ b/src/CommandLine/Imagemagick.php @@ -130,11 +130,21 @@ class Imagemagick extends CommandLine $cl->setManualArg('-format "%[fx:int(255*r+.5)],%[fx:int(255*g+.5)],%[fx:int(255*b+.5)]"'); $cl->setManualArg('info:-'); $cl->execute(); - $cl->debug(); return new Color('rgb(' . trim($cl->getOutput()) . ')'); + } -// convert cat.png -resize 1x1\! \ -// -format "%[fx:int(255*r+.5)],%[fx:int(255*g+.5)],%[fx:int(255*b+.5)]" info:- + public static function brightnessContrast($image, $dest, $brightness = 0, $contrast = 0) + { + if (!$brightness && !$contrast) { + copy($image, $dest); + return; + } + $cl = new self(); + $cl->setArg(null, $image); + $cl->setManualArg('-brightness-contrast ' . $brightness . 'x' . $contrast); + $cl->setArg(null, $dest); + $cl->execute(); + $cl->debug(); } } -- 2.39.5