Skip to content

Commit

Permalink
Fix color extractor instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoLegends committed Aug 16, 2016
1 parent 44e7b19 commit 3c07c63
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Duplexmedia/ImageTools/ImageTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Duplexmedia\ImageTools;
use League\ColorExtractor\ColorExtractor;
use League\ColorExtractor\Palette;

/**
* A class with a couple of useful image processing functions.
Expand Down Expand Up @@ -91,7 +92,7 @@ public function getAccentColors($number = 5, $sampleSize = 500, $maxBrightness =
$this->image->setImageFormat("png");
$this->image->resizeImage($sampleSize, $sampleSize, \Imagick::FILTER_LANCZOS, 1, true);
$this->image->writeImage($fileName);
$image = new ColorExtractor(imagecreatefrompng($fileName));
$image = new ColorExtractor(Palette::fromFilename($fileName));

$results = array_filter($image->extract($number), function ($color) use ($maxBrightness) {
return $maxBrightness < 0 || $this->colorTools->calculateBrightness($color) < $maxBrightness;
Expand Down

0 comments on commit 3c07c63

Please sign in to comment.