Jump to content

PIXI svg to raster


Recommended Posts


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.




Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...