I came across https://ui-avatars.com, a web service that creates avatar images based on some parameters.

From Pharo, the shortest invocation would be something like

ZnEasy getPng: 'https://ui-avatars.com/api?name=Albert+Einstein&size=128&background=0D8ABC&color=fff&rounded=true'.

Making use of the full builder interface of ZnClient that would look more like

ZnClient new
  https;
  host: 'ui-avatars.com';
  addPath: #api;
  queryAt: #name put: 'Albert Einstein';
  queryAt: #size put: 128;
  queryAt: #color put: 'FFF';
  queryAt: #background put: '0D8ABC';
  queryAt: #rounded put: true;
  accept: ZnMimeType imagePng;
  enforceHttpSuccess: true;
  enforceAcceptContentType: true;
  contentReader: [ :entity | ImageReadWriter formFromStream: entity readStream ];
  beOneShot;
  get.

Anyway, it is cool to have an environment that makes this kind of experimentation so much fun.


It is probably easy to implement this avatar image generation directly in Pharo ...

Sven