namespace Cubist\Util\CommandLine;
use Cubist\Util\CommandLine;
+use Cubist\Util\Graphics\Color;
class Imagemagick extends CommandLine
{
$cl->execute();
}
+ public static function getAverageColor($image)
+ {
+ $cl = new self();
+ $cl->setArg(null, $image);
+ $cl->setManualArg('-resize 1x1\!');
+ $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:-
+ }
+
}