Refactores area average color algorithm to a method