Hmm. The jpeg requirement seems odd. Even if it has "jpg" in the url, you can serve up a standalone SVG (with a jpg extension in the url) as long as you send the right MIME type. The example SVG above shows it's probably going to be lighter weight than pulling in a java image library.
Comments
i'm stuck generating avatars server-side in java - anyone know of a good package ?
Others pointed out doing it with css works fine.
You could also just generate inline SVG in the html, something like this: https://jsfiddle.net/8tfjqjmy/
i don't control the client (html or javascript) - i'm reimplementing the server side api
so i need to generate the avatar on the server side as a jpeg
Hmm. The jpeg requirement seems odd. Even if it has "jpg" in the url, you can serve up a standalone SVG (with a jpg extension in the url) as long as you send the right MIME type. The example SVG above shows it's probably going to be lighter weight than pulling in a java image library.