{"record":{"id":"60795d8b0f6372b2","repo":"Anuken/Mindustry","slug":"image-is-too-large-maximum-size-is-mapresizedial","errorCode":null,"errorMessage":"Image is too large (maximum size is {MapResizeDialog.maxSize}x{MapResizeDialog.maxSize})","messagePattern":"Image is too large \\(maximum size is (.+?)x(.+?)\\)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"core/src/mindustry/editor/MapEditorDialog.java","lineNumber":114,"sourceCode":"                \"@editor.importfile\", \"@editor.importfile.description\", Icon.file, (Runnable)() ->\n                FileChooser.open(mapExtension).submit(file -> ui.loadAnd(() -> {\n                    maps.tryCatchMapError(() -> {\n                        if(MapIO.isImage(file)){\n                            ui.showInfo(\"@editor.errorimage\");\n                        }else{\n                            editor.beginEdit(MapIO.createMap(file, true));\n                        }\n                    });\n                })),\n\n                \"@editor.importimage\", \"@editor.importimage.description\", Icon.fileImage, (Runnable)() ->\n                FileChooser.open(\"png\").submit(file ->\n                ui.loadAnd(() -> {\n                    try{\n                        Pixmap pixmap = new Pixmap(file);\n                        //if you want to bypass the limit, use mods or the console; larger maps are not supported\n                        if(pixmap.width > MapResizeDialog.maxSize || pixmap.height > MapResizeDialog.maxSize){\n                            throw new Exception(\"Image is too large (maximum size is \" + MapResizeDialog.maxSize + \"x\" + MapResizeDialog.maxSize + \")\");\n                        }\n                        editor.beginEdit(pixmap);\n                        pixmap.dispose();\n                    }catch(Exception e){\n                        ui.showException(\"@editor.errorload\", e);\n                        Log.err(e);\n                    }\n                })))\n            );\n\n            t.button(\"@editor.export\", Icon.upload, () -> createDialog(\"@editor.export\",\n            \"@editor.exportfile\", \"@editor.exportfile.description\", Icon.file,\n                (Runnable)() -> FileChooser.export(editor.tags.get(\"name\", \"unknown\"), mapExtension, file -> MapIO.writeMap(file, editor.createMap(file))),\n            \"@editor.exportimage\", \"@editor.exportimage.description\", Icon.fileImage,\n                (Runnable)() -> FileChooser.export(editor.tags.get(\"name\", \"unknown\"), \"png\", file -> {\n                    Pixmap out = MapIO.writeImage(editor.tiles());\n                    file.writePng(out);\n                    out.dispose();","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/editor/MapEditorDialog.java#L96-L132","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Downscale the PNG so both dimensions are <= 800 before importing.","Raise the cap programmatically: MapResizeDialog.maxSize = 1024; (only if you understand the memory cost).","Use a mod or the console to load larger maps, as the comment suggests, if you genuinely need bigger maps."],"exampleFix":"// before: importing a 1024x1024 PNG throws\n// after: raise the cap (do this once at startup)\nMapResizeDialog.maxSize = 1024;","handlingStrategy":"validation","validationCode":"// check dimensions against the cap before importing\nPixmap pixmap = new Pixmap(file);\nif(pixmap.width > MapResizeDialog.maxSize || pixmap.height > MapResizeDialog.maxSize){\n    ui.showErrorMessage(\"Image exceeds \" + MapResizeDialog.maxSize + \"x\" + MapResizeDialog.maxSize);\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-scale source PNGs to <= 800px in both dimensions.","If you need larger maps, set MapResizeDialog.maxSize deliberately and document the memory cost.","Surface a friendly message instead of relying on the caught exception."],"tags":["editor","image-import","limits","ui"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}