Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmap class - new createjs.Bitmap - SVG not loading at viewbox size #1070

Open
prbrowne opened this issue Apr 8, 2022 · 1 comment
Open

Comments

@prbrowne
Copy link

prbrowne commented Apr 8, 2022

Using the Bitmap class, new createjs.Bitmap, with SVG, the SVG is loaded at some enormous size, without reference to the SVG's viewbox for dimensions.

This doesn't happen with other images formats like PNG, which load at the original size.

Scaling the SVG is not an option for responsive sites.

SVG should load at the set width and height as per the viewbox in the SVG code. All I want is SVG to load at its original size without using scaling.

https://stackoverflow.com/questions/71790667/create-js-easel-js-createjs-bitmap-getting-svg-to-load-at-original-size

@prbrowne prbrowne changed the title Bitmap class - new createjs.Bitmap - Issue with SVG dimensions Bitmap class - new createjs.Bitmap - SVG not loading at viewbox size Apr 9, 2022
@danzen
Copy link
Contributor

danzen commented Sep 12, 2022

@prbrowne sorry for the delayed response here. I don't know any more than what Lanny replied in the StackOverflow link but I do know that in ZIM we implemented two ways to handle SVG - one is a function that converts the SVG to an image and works pretty well flawlessly as far as we can tell. The other is to convert SVG to ZIM shapes and that has the advantage of making them editable. https://zimjs.com/svg/

If you look at the ZIM code for SVGToBitmap https://zimjs.com/code.php?view=83.27&title=svgToBitmap&line=74632 you can see the code that we used. You may be able to adapt it. Or consider using ZIM. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants