dmpanis Posted December 26, 2019 Share Posted December 26, 2019 Hello, When I rasterise a svg file the generated texture has a fixed width and height of 150 pixels. I need to have a custom size each time and I just can't figure out how I am supposed to do that. I tried the following: let texture = PIXI.Texture.from("https://ik.imagekit.io/bugtown/2.svg", {width: 250, height: 250}); this.addChild( new PIXI.Sprite(texture) ); The passed width, height object has no result at all. When I pass the following: let texture = PIXI.Texture.from("https://ik.imagekit.io/bugtown/2.svg", {resourceOptions: {width: 250, height: 250}}); this.addChild( new PIXI.Sprite(texture) ); The svg vector is rendered with the correct dimensions but the displayed sprite is cropped and what I get is the following: Which is the correct raster of the svg but in a frame of 150x150 pixels and this is the best I can get out of my svg to raster efforts. I tried updating the frame and calling updateUvs but there is no result. Any ideas on what I am missing would be highly appreciated. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 26, 2019 Share Posted December 26, 2019 (edited) Oh, you can pass "scale" in resourceOptions too, according to https://github.com/pixijs/pixi.js/blob/dev/packages/core/src/textures/resources/SVGResource.js#L38 Edited December 26, 2019 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
dmpanis Posted December 30, 2019 Author Share Posted December 30, 2019 The result is the same, the rasterised texture is cropped. It looks like there is a bug in how PIXI handles svg or I just can get it right. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 31, 2019 Share Posted December 31, 2019 debug SVGResource, place a breakpoint there. Its the place where everyone who need SVG go. Its really not main pixijs feature and its mostly maintained by its active users. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.