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

patlas

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

patlas

Simple texture atlas packer

  • 0.0.6
  • PyPI
  • Socket score

Maintainers
1

image Build

A simple, runtime-dependency-free texture atlas packer.

Basic usage:

from patlas import AtlasPacker, load
from glob import glob

ap = AtlasPacker(side=2048, pad=2)
ap.pack(glob('images/*.png')) # list of images
ap.pack(['images/image.jpg']) # can call multiple times (packing quality may suffer)

ap.atlas # memoryview of RGBA texture
ap.metadata # dictionary of image locations and image format

ap.save('atlas') # serialize as custom .patlas file

atlas, metadata = load('atlas.patlas')

See demo.py for example usage with ModernGL.

Features/limitations:

  • Uses stb_image, stb_rect_pack, and stb_dxt from stb
    • Can import any image format stb_image can (see here)
  • Only square RGBA textures (currently)
  • Optional DXT5/BC3(?) compression
  • Optional OpenMP support (disabled by default to reduce wheel size) can substantially reduce runtime. To enable, build from source with OMP=1 set in the environment, e.g. OMP=1 pip install patlas --no-binary patlas
    • On Windows, should "just work"?
    • MacOS may need extra packages, e.g. libomp from brew
    • Linux may need extra packages, e.g. libomp-dev on Ubuntu
  • Save to a custom .patlas file
    • Uses qoi image format + zlib for fast and small encoding/decoding
    • See the save method of AtlasPacker for gory details
  • Includes a command-line utility (see patlas --help for details)
  • Requires Cython at build time (but source distribution should have pre-generated .c files)

FAQs


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