You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

potpack

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

potpack

A tiny library for packing 2D rectangles (for sprite layouts)

2.1.0
latest
Source
npmnpm
Version published
Maintainers
1
Created

What is potpack?

The potpack npm package is a utility for packing rectangles into a single bin. It is useful for tasks such as packing images into a texture atlas or arranging elements in a confined space efficiently.

What are potpack's main functionalities?

Rectangle Packing

This feature allows you to pack a list of rectangles into a single bin. The function returns the width and height of the bin and the fill rate. The input rectangles are modified to include their x and y positions in the bin.

const potpack = require('potpack');

const rectangles = [
  { w: 100, h: 200 },
  { w: 300, h: 100 },
  { w: 50, h: 50 }
];

const { w, h, fill } = potpack(rectangles);
console.log(`Packed width: ${w}, height: ${h}, fill: ${fill}`);
console.log('Rectangles:', rectangles);

Other packages similar to potpack

Keywords

algorithms

FAQs

Package last updated on 14 Jul 2025

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