Jump to content

Download JPEG image from PixiJS application


munasinghecm
 Share

Recommended Posts

I created an app using PixiJS. I set height and width for the PIXI.Application. I added containers which are having the graphics relevant to my application. When I draw those graphics some of them are go beyond the boundary limit of the application. When I render the application it's totally fine. Only the application area get rendered without the graphics which drew beyond the boundary limit of the app. 

Though when I get an image from the application using the following code, the graphics which drew beyond the boundary limit of the application are also available in that image. 

 this.pixiApp.renderer.plugins.extract.image(this.pixiApp.stage, 'image/jpge', 1)

How can I download an image only containing the graphics which are available within the app boundary limit. 

Link to comment
Share on other sites

I set height and width for the PIXI.Application
its screen size , and it gets stored in "app.screen"

> beyond the boundary limit of the application

yep

image() and a few others functions of extract are actually using getLocalBounds() of object you pass there, and of course its bigger than screen.

You have to use method that creates you a texture of arbitrary size, like https://pixijs.download/dev/docs/PIXI.Renderer.html#generateTexture

dont forget to destroy the texture after you used it for image()

basically, extract does the same thing, it just doesnt have this "options.region" param. You can set that region to "app.screen" , no need to create your own rectangle )

Yes, that's the problem in API because there are already too many params in "image" method

Edited by ivan.popelyshev
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.

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