potpack

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

fit-box

Fits a box within a boundary while keeping its original aspect ratio