ethanresnick / ImagineExtensionsBundle

Some extra features and filters for the AvalancheImageBundle.
1 stars 1 forks source link

DeltaE conversion incorrect #1

Open jove4015 opened 11 years ago

jove4015 commented 11 years ago

Hi,

I've been trying to track down a problem with this code for days, and finally found it. Your DeltaE2000 conversion method did not match other formulas online I've found for computing DeltaE2000, and it was producing results that didn't seem to make sense given the colors we were trying to match.

As it turns out, your formula had one consistent mistake - instead of using rad2deg to convert radians to degrees, you should be using deg2rad, as PHP trig functions take radians as arguments, not degrees. See http://php.net/manual/en/function.sin.php. With this simple change your formula matches perfectly - and is extremely helpful to me. Thank you!!

ethanresnick commented 11 years ago

Hi,

I'm glad you're finding the code useful and sorry about the bug—I could really use some unit tests.

Anyway, can you submit a PR with the proper version and I'll gladly pull it in.

Cheers!