Closed mreiden closed 6 years ago
Thank you for this ! Just one thing, may i ask you to add a test case for this scenario ?
Added a test.
For my information, did you noticed any impact of this miscalculation on the accuracy of the final color palette ? It looks like it's changing the number of colors returned in the palette for a single color image
An image that fits in a single histogram bucket (single color image) causes VBox->volume to be invalid and negative (instead of 1) due to not setting rgbMax in addition to rgbMax. This leaves rgbMax at 0 causing VBox to compute a negative and incorrect volume when calculated as
$this->volume = (($this->r2 - $this->r1 + 1) * ($this->g2 - $this->g1 + 1) * ($this->b2 - $this->b1 + 1));