Sign in to follow this  
dmpanis

PIXI svg to raster

Recommended Posts

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:

image.png.dcc40a53dbaaa108cc6b1181d57d7618.png

 

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.

 

 

 

Share this post


Link to post
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.

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.