palette[generator]: Fix removing an already-removed element.
palette[generator]: Simplify ColorHistogram computation.

When copying and sorting image pixels.