Removed code duplication between icon and thumbnail generation
Merge pull request #316 from kux/code_refactoring

Small refactoring: removed code duplication between icon and thumbnail generation