Users of stackoverflow.com who do not upload their photos have an image pattern in their photo area. These are simple but different for all users and that is very impressive. Each one has a central square and outer border, both are usually filled with patterns. Is the code for making these image patterns available or how can they be created? Can they be created in R?
Compute a hash of the email address with package digest
:
d <- digest('[email protected]', algo='md5', serialize=FALSE)
d
## [1] "b1554c62bf1d05a4a9c48754a6619c17"
Then ask gravatar for the image:
download.file(paste0('http://www.gravatar.com/avatar/', d, '.png?d=identicon'), mode='wb', destfile='ab.png')
## trying URL 'http://www.gravatar.com/avatar/b1554c62bf1d05a4a9c48754a6619c17.png?d=identicon'
## Content type 'image/png' length 2280 bytes
## opened URL
## ==================================================
## downloaded 2280 bytes
The mode='wb'
is required for Windows systems. mode='w'
is the default, and the b
flag is ignored on non-Windows systems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With