OpenFairyGUI API
    Preparing search index...

    Function atlas

    • Packs image resources into texture atlases.

      This transform performs MaxRects bin-packing on all ImageResource items within each package, creating Atlas and Sprite property nodes. When an a raster backend is provided, it also composites the actual PNG files.

      When trimImage is enabled and encoder is available, transparent pixels at image edges are trimmed before packing. The trimmed offset and original dimensions are stored in the Sprite nodes for runtime reconstruction.

      import sharp from 'sharp';
      await doc.transform(atlas({
      encoder: sharp,
      maxSize: 2048,
      trimImage: true,
      basePath: './assets/',
      outputPath: './dist/',
      }));

      Parameters

      Returns Transform