Add support for an svg > image element #829
swampthang
started this conversation in
Ideas
Replies: 1 comment
-
You can convert the SVG element to Blob URL, and load it with an image element. For example: const svg = `<svg xmlns="http://www.w3.org/2000/svg" ...`;
const blob = new Blob([svg], {type: 'image/svg+xml'});
const url = URL.createObjectURL(blob);
const image = document.createElement('img');
image.src = url;
image.addEventListener('load', () => {
URL.revokeObjectURL(url);
}, {
once: true,
});
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks for the awesome library!
I have need for a cropper that would work on an image contained in an SVG like this - example taken from this page.
How difficult would it be to add support for that?
Beta Was this translation helpful? Give feedback.
All reactions