Unfortunately switching to kcolor didn't improve quality. 

I suspect it's because it's computing distance in linear RGB colorspace, which is less perceptually accurate than computation straight in sRGB. This is because linear color gives linear [luminance](http://en.wikipedia.org/wiki/Luminance_(relative)), but luminance has non-linear relationship with perceived [lightness](http://en.wikipedia.org/wiki/Lightness_(color))

Converted to linear RGB (notice disproportionately heavy deformation in dark areas):
![t-gamma22](https://cloud.githubusercontent.com/assets/72159/2620675/68c12d24-bc42-11e3-8f32-41aa8d0f97bf.gif)

Kept in gamma 2.2:
![t-gamma10](https://cloud.githubusercontent.com/assets/72159/2620852/c07f4cbe-bc45-11e3-86a6-21ae3948b43a.gif)