Fixed most thumbnailing issues, with an RGB conversion.
And fixed average color detection, also with an RGB conversion.
Merge remote-tracking branch 'upstream/master'
Cleanup code.
Pulled common code into utility function.
Merge pull request #15 from lordastley/master

Fix thumbnailing and average image color calculation