How to Set Avatar via Plugin

Thank you very much for your help, I managed to get it working.
As you said the file has to be named avatar_ followed by the base64 encoding of the “CLIENTID=” (replace CLIENTID with your clientID).
I don’t think there is anything special about the base64 encoding you posted, I used a simple online encoder and it worked.
For the md5 as you said setting the md5 hash of the image file as CLIENT_FLAG_AVATAR is correct.
With this I can set my Avatar programmatically, it’s just the size that is different than setting it with normal “Set Avatar”, but I’ll look more into that later.