This release fixes a compatibility issue with Next.js caused by the converter
that can convert generated SVG avatars to PNG and JPEG. As of this version, the
converter is no longer part of the core library and must be installed
separately.
Breaking changes
- `toDataUri` is now synchronous and `toDataUriSync` has been removed
accordingly.
- `toPng` and `toJpeg` have been removed. These functions can still be used if
the `dicebear/converter` library is installed, which provides these two
methods.
Before:
js
import { createAvatar } from 'dicebear/core';
import { bottts } from 'dicebear/collection';
const avatar = createAvatar(bottts);
const png = await avatar.toPng();
After:
js
import { createAvatar } from 'dicebear/core';
import { bottts } from 'dicebear/collection';
import { toPng } from 'dicebear/converter';
const avatar = createAvatar(bottts);
const png = await toPng(avatar);
See [Documentation](https://www.dicebear.com/how-to-use/js-library/converter/)
for more information.
- `toFile` has been removed as the behaviour of the function cannot be kept
consistent across the environments. Such a method must be implemented
yourself.
- `toArrayBuffer` for SVG format has been removed.
New features
- `toPng` and `toJpeg` now support `fonts` as an option to set custom fonts. See
[Documentation](https://www.dicebear.com/how-to-use/js-library/converter/) for
more information.