Skip to content

[Feature request] Recognise TexturePacker / Aseprite JSON from other exporters (meta.app whitelist) #1915

Done

Description

@caicai-code-maker

Is your feature request related to a problem? Please describe.

TextureAtlas chooses a parser with identifyFormat(atlas.meta.app), which only accepts a meta.app containing "texturepacker", "free-tex-packer", "shoebox", "aseprite" or "melonJS" (packages/melonjs/src/video/texture/atlas.js, lines 88–100 on master). Other tools that write the same TexturePacker or Aseprite JSON structure, but put their own name or URL in meta.app, are rejected before any parsing:

Error: Unknown texture atlas format: https://spritesheet.dev/

What I checked with melonJS 20.17.0 from npm in headless Chromium (Canvas and WebGL 2 renderers for the TexturePacker files, Canvas for the Aseprite one):

  • A TexturePacker JSON (Array) file from spritesheet.dev is rejected with the error above. The same file with only meta.app changed to https://www.codeandweb.com/texturepacker loads, and every frame's name, rectangle and drawn pixels match the sheet.
  • An Aseprite JSON export from spritesheet.dev is rejected the same way. With only meta.app changed to https://www.aseprite.org/ it loads as format "aseprite".
  • Separately, parseTexturePacker iterates data.frames.forEach(...), so TexturePacker's "JSON (Hash)" variant (frames as an object keyed by name) fails with frames.forEach is not a function even when meta.app is recognised.

Minimal repro:

const json = {
  frames: [{ filename: "a", frame: { x: 0, y: 0, w: 16, h: 16 }, rotated: false, trimmed: false,
             spriteSourceSize: { x: 0, y: 0, w: 16, h: 16 }, sourceSize: { w: 16, h: 16 } }],
  meta: { app: "https://example.com/my-packer", version: "1.0", image: "sheet.png",
          format: "RGBA8888", size: { w: 16, h: 16 }, scale: "1" },
};
new me.TextureAtlas(json, image); // Error: Unknown texture atlas format: https://example.com/my-packer

Describe the solution you'd like

When meta.app isn't one of the known names, fall back to the structure of the file instead of throwing, for example:

  • meta.frameTags present (Aseprite always writes it) → Aseprite parser;
  • otherwise frames with frame rectangles plus meta.image → TexturePacker parser.

It would also help if parseTexturePacker accepted the Hash variant (iterate Object.entries(frames) when frames isn't an array, using the key as the frame name).

That way any exporter that writes these formats works, without having to claim to be TexturePacker or Aseprite.

Describe alternatives you've considered

  • Writing "texturepacker" or "aseprite" into our own meta.app. It works today, but it misstates which app wrote the file, so we'd rather not.
  • Telling users to edit meta.app by hand.

Additional context

Disclosure: I make spritesheet.dev, a free browser tool that writes TexturePacker JSON (Hash and Array) and Aseprite JSON. I ran into this while checking our exports against several engines.

Text drafted with help from an AI assistant.

Activity

  1. obiot commented on Nov 25, 2026

    @obiot
    Member

    Thanks for the detailed report. This is fixed in #1917:

    • an atlas whose meta.app is not a tool melonJS knows by name is now recognised from the structure of the file, so your exports load under your own name;
    • TexturePacker "JSON (Hash)" is read as "JSON (Array)" is;
    • spritesheet.dev is added to our list of supported tools.

    It will ship in melonJS 20.18.0.

    Here is a melonJS loading example you can reuse on spritesheet.dev, next to the Phaser and Pixi ones:

    import { loader, TextureAtlas } from "melonjs";
    
    await loader.preload([
        { name: "hero", type: "image", src: "hero.png" },
        { name: "hero", type: "json",  src: "hero.json" },
    ]);
    
    const atlas = new TextureAtlas(loader.getJSON("hero"), loader.getImage("hero"));
    
    const hero = atlas.createAnimationFromName(["walk_0", "walk_1", "walk_2", "walk_3"]);
    hero.pos.set(400, 300);
    app.world.addChild(hero);

    It works for the TexturePacker (Hash or Array) and Aseprite JSON exports alike. For a single frame, use atlas.createSpriteFromName("walk_0").


    Generated by Claude Code

  2. added a commit that references this issue on Nov 25, 2026
    28ffce8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions