Jump to content

Scaling down big images quality


sta-ger
 Share

Recommended Posts

Hello!

I have a trouble when scaling down big assets. I just have a stage contains some sprite and i'm doing:
stage.scale.x = stage.scale.y = 0.2;

https://jsfiddle.net/n67xwb5w/

As a result I have an ugly ragged image. I found a solutions for a simple canvas drawing without pixi

http://jsfiddle.net/qwDDP/

from here

http://stackoverflow.com/questions/18761404/how-to-scale-images-on-a-html5-canvas-with-better-interpolation

 

Can I achive the same smooth effect after rescaling in PIXI?

Screenshot_3.png

Link to comment
Share on other sites

PIXI works through two contexts: 2d and webgl. WebGL cant resize images properly, unless you enable mipmapping.

Condition for mipmapping : your images must have power-of-two width and height (1024x512 or something like that)

Put "texture.baseTexture.mipmap = true;" just after you load the texture. In pixi-v4 its not required, it is set by default.

You can also use your method for scale with "var tex = PIXI.Texture.fromCanvas(myCanvas);"

Link to comment
Share on other sites

  • 1 year later...

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

  • Recently Browsing   0 members

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