public function getColorPalette($image, $colorCount, $quality, $colorValue)
    {
        try {
            $source = new LocalSourceImageModel($image);
            $source->getLocalCopy();
        } catch (ImagerException $e) {
            return null;
        }

        $palette = ColorThief::getPalette($source->getFilePath(), $colorCount, $quality);

        ImagerService::cleanSession();

        return $colorValue === 'hex' ? $this->paletteToHex($palette) : $palette;
    }
public function getColorPalette($image, $colorCount, $quality, $colorValue)
    {
        try {
            $source = new LocalSourceImageModel($image);
            $source->getLocalCopy();
        } catch (ImagerException $e) {
            return null;
        }

        $palette = ColorThief::getPalette($source->getFilePath(), $colorCount, $quality);

        ImagerService::cleanSession();

        return $colorValue === 'hex' ? $this->paletteToHex($palette) : $palette;
    }
public function getColorPalette ( $ image , $ colorCount , $ quality , $ colorValue ) { try { $ source = new LocalSourceImageModel ( $ image ) ; $ source -> getLocalCopy ( ) ; } catch ( ImagerException $ e ) { return null ; } $ palette = ColorThief :: getPalette ( $ source -> getFilePath ( ) , $ colorCount , $ quality ) ; ImagerService :: cleanSession ( ) ; return $ colorValue === 'hex' ? $ this -> paletteToHex ( $ palette ) : $ palette ; }
Gets color palette for image

@param Asset|string $image
@param int $colorCount
@param int $quality
@param string $colorValue

@return array|null
Gets color palette for image