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.
so i need to generate the avatar on the server side as a jpeg