Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/extract

Package Overview
Dependencies
Maintainers
2
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/extract

Extract raw graphics data from renderer

  • 7.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
112K
decreased by-10.18%
Maintainers
2
Weekly downloads
 
Created

What is @pixi/extract?

@pixi/extract is a package that provides utilities for extracting image data from PIXI.js display objects. It allows you to convert display objects into different formats such as base64 strings, image data, or raw pixel data.

What are @pixi/extract's main functionalities?

Extracting Base64 String

This feature allows you to extract a display object as a base64 encoded string. The code sample demonstrates creating a red rectangle and extracting it as a base64 string using the extract plugin.

const app = new PIXI.Application();
const graphics = new PIXI.Graphics();
graphics.beginFill(0xff0000);
graphics.drawRect(0, 0, 100, 100);
graphics.endFill();
app.stage.addChild(graphics);
const base64 = app.renderer.plugins.extract.base64(graphics);

Extracting Image Data

This feature allows you to extract a display object as an HTMLImageElement. The code sample shows how to create a green circle and extract it as an image element.

const app = new PIXI.Application();
const graphics = new PIXI.Graphics();
graphics.beginFill(0x00ff00);
graphics.drawCircle(50, 50, 50);
graphics.endFill();
app.stage.addChild(graphics);
const imageData = app.renderer.plugins.extract.image(graphics);

Extracting Pixels

This feature allows you to extract raw pixel data from a display object. The code sample demonstrates creating a blue ellipse and extracting its pixel data as a Uint8Array.

const app = new PIXI.Application();
const graphics = new PIXI.Graphics();
graphics.beginFill(0x0000ff);
graphics.drawEllipse(50, 50, 50, 25);
graphics.endFill();
app.stage.addChild(graphics);
const pixels = app.renderer.plugins.extract.pixels(graphics);

Other packages similar to @pixi/extract

FAQs

Package last updated on 31 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc