public function getHistogramData($channels, $colorMode = Color::HSL) {
		$colors = array_fill(0, 256, 0);
		for($y = 0; $y < $this->height; ++$y) {
			for($x = 0; $x < $this->width; ++$x) {
				$rgb = imagecolorat($this->image, $x, $y);
				$r = ($rgb >> 16) & 0xff;
				$g = ($rgb >> 8) & 0xff;
				$b = $rgb & 0xff;
				switch ($channels) {
					case Channel::RGB:
						switch($colorMode) {
							case Color::HSL:
								// HSL algorithm
								$luminescence = (max($r, $g, $b) + min($r, $g, $b)) / 2;
								break;
							case Color::HSV:
								// HSV algorithm
								$luminescence = max($r, $g, $b);
								break;
							case Color::HSI:
								// HSI algorithm
								$luminescence = ($r + $g + $b) / 3;
								break;
							default:
								// fastest
								$luminescence = ($r + $r + $r + $b + $g + $g + $g + $g) >> 3;
								break;
						}
						break;
					case Channel::RED:
						$luminescence = $r;
						break;
					case Channel::GREEN:
						$luminescence = $g;
						break;
					case Channel::BLUE:
						$luminescence = $b;
						break;
				}
				++$colors[$luminescence];
			}
		}

		return $colors;
	}