Anuken/Mindustry · warning · Exception

Image is too large (maximum size is {MapResizeDialog.maxSize

Error message

Image is too large (maximum size is {MapResizeDialog.maxSize}x{MapResizeDialog.maxSize})

What it means

Thrown when importing a PNG into the map editor whose width or height exceeds MapResizeDialog.maxSize (default 800). The cap protects memory and editor performance for very large custom maps. The exception is caught immediately and shown to the user via ui.showException, so it is a user-facing error, not a crash. To bypass, the comment notes using mods or the console.

Source

Thrown at core/src/mindustry/editor/MapEditorDialog.java:114

                "@editor.importfile", "@editor.importfile.description", Icon.file, (Runnable)() ->
                FileChooser.open(mapExtension).submit(file -> ui.loadAnd(() -> {
                    maps.tryCatchMapError(() -> {
                        if(MapIO.isImage(file)){
                            ui.showInfo("@editor.errorimage");
                        }else{
                            editor.beginEdit(MapIO.createMap(file, true));
                        }
                    });
                })),

                "@editor.importimage", "@editor.importimage.description", Icon.fileImage, (Runnable)() ->
                FileChooser.open("png").submit(file ->
                ui.loadAnd(() -> {
                    try{
                        Pixmap pixmap = new Pixmap(file);
                        //if you want to bypass the limit, use mods or the console; larger maps are not supported
                        if(pixmap.width > MapResizeDialog.maxSize || pixmap.height > MapResizeDialog.maxSize){
                            throw new Exception("Image is too large (maximum size is " + MapResizeDialog.maxSize + "x" + MapResizeDialog.maxSize + ")");
                        }
                        editor.beginEdit(pixmap);
                        pixmap.dispose();
                    }catch(Exception e){
                        ui.showException("@editor.errorload", e);
                        Log.err(e);
                    }
                })))
            );

            t.button("@editor.export", Icon.upload, () -> createDialog("@editor.export",
            "@editor.exportfile", "@editor.exportfile.description", Icon.file,
                (Runnable)() -> FileChooser.export(editor.tags.get("name", "unknown"), mapExtension, file -> MapIO.writeMap(file, editor.createMap(file))),
            "@editor.exportimage", "@editor.exportimage.description", Icon.fileImage,
                (Runnable)() -> FileChooser.export(editor.tags.get("name", "unknown"), "png", file -> {
                    Pixmap out = MapIO.writeImage(editor.tiles());
                    file.writePng(out);
                    out.dispose();

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Downscale the PNG so both dimensions are <= 800 before importing.
  2. Raise the cap programmatically: MapResizeDialog.maxSize = 1024; (only if you understand the memory cost).
  3. Use a mod or the console to load larger maps, as the comment suggests, if you genuinely need bigger maps.

Example fix

// before: importing a 1024x1024 PNG throws
// after: raise the cap (do this once at startup)
MapResizeDialog.maxSize = 1024;
Defensive patterns

Strategy: validation

Validate before calling

// check dimensions against the cap before importing
Pixmap pixmap = new Pixmap(file);
if(pixmap.width > MapResizeDialog.maxSize || pixmap.height > MapResizeDialog.maxSize){
    ui.showErrorMessage("Image exceeds " + MapResizeDialog.maxSize + "x" + MapResizeDialog.maxSize);
    return;
}

Prevention

When it happens

Trigger: FileChooser.open('png') picks a PNG, Pixmap is constructed from it, and pixmap.width > 800 or pixmap.height > 800 triggers the throw. The check compares against MapResizeDialog.maxSize (static, default 800, mutable).

Common situations: User imports a high-resolution image (e.g. 1024x1024 or larger) as a map; someone raised maxSize elsewhere expecting it to apply; large screenshots used as map sources.

Related errors


AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14). Data as JSON: /api/errors/60795d8b0f6372b2. Report an issue: GitHub.