]> _ Git - cubist_util.git/commitdiff
wip #6300 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 28 Sep 2023 06:54:51 +0000 (08:54 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 28 Sep 2023 06:54:51 +0000 (08:54 +0200)
src/CommandLine/Imagemagick.php

index ec1090d14e8a7855d3099a2e57b7423ee51b29fa..4096229e1d9a6291e168e4213f436d6a30b8a787 100644 (file)
@@ -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();
     }
 
 }