Added compatibility with Cinnamon DE for linux, and small fix

Added detection of desktop environment for linux, and can be extended for other DEs but the key to look for may not be the same.
Got the idea from http://stackoverflow.com/questions/2035657/what-is-my-current-desktop-environment
While testing for windows, I also found that "wb" should be used for writing the file in order to avoid image corruption