Usage¶
py-squaremap-combiner ¶
Python script written to combine the images generated by the squaremap Minecraft plugin. Not affiliated with squaremap or its authors.
The seed used for the world the sample images were created from is -2590089827693666277.
Contents ¶
Features¶
Stitch all squaremap-generated images for a given world into a single large map
Export an image of only a specified area of the Minecraft world, by its in-game coordinates
Grid overlay for maps, representing in-game coordinates
Grid lines and coordinate text can be toggled individually, and styled to a given color, font, and font size
Installing¶
Install the package with pip:
pip install git+https://github.com/svioletg/py-squaremap-combiner.git`
Then, either use it as a command via squaremap-combine…
squaremap-combine run my-tiles overworld --zoom=2 -o worldmap_z2.png
…or import it and use as an API.
from squaremap_combine.combine_core import Combiner
combiner = Combiner('my-tiles')
map_image = combiner.combine('minecraft_overworld', zoom=2) # Returns a PIL.Image.Image object
map_image.save('output.jpg')
Logging¶
This project uses loguru for its logging. Logging is disabled
by default for API usage, but enabled at the INFO level when run as a command.
Log files are saved to your user data directory (e.g. C:\Users\<user>\AppData or ~/.local/share)
in its logs directory. Run squaremap-combine logs to print its path.
Basic CLI Usage¶
The squaremap-combine run command will stitch together images from a given world/dimension
directory into a single map. This directory will be located in your server’s plugins directory,
under squaremap/web/tiles/<world>. For example, if your current working directory is where your
server JAR is located, the most basic example may look like this:
squaremap-combine run -i plugins/squaremap/web/tiles/minecraft_overworld -o overworld.png
You can alternatively use the sqmapcom command in place of squaremap-combine as a shortcut:
sqmapcom run -i plugins/squaremap/web/tiles/minecraft_overworld -o overworld.png
CLI Options¶
[!NOTE] “List” option types All “[xyz] list” options expect values to be given separated by comma as a single option, e.g.
--grid=32,32or--area=-100,-100,100,100.
Option |
Type |
Default |
Description |
|---|---|---|---|
|
Flag |
N/A |
Displays information about every argument / option and their parameters. |
|
Directory path |
N/A |
Path to a world folder subdirectory under squaremap’s “tiles” directory. This is required when using the |
|
Integer |
3 |
The zoom/detail level of tiles to use. Defaults to the highest level of 3, which is 1 block per pixel. |
|
File path |
|
Where to save the combined map image. Defaults to the current directory and named after the world folder name. |
|
Flag |
|
Allows the script to overwrite an existing file with the same target name if it already exists. By default, if an image with the same path already exists, a numbered suffix is added. |
|
Integer list (4) |
Entire rendered map area |
A rectangle area of the world to export an image of, separated by commas. |
|
Integer list(2) OR |
|
A size in pixels to crop the final image to. If “auto”, trims empty (fully transparent) space surrounding the completed image. |
|
Integer list (2) |
|
Defines the grid interval, which adds grid lines to the image based on Minecraft’s coordinates. Grid overlay can be further customized with the |
|
Flag |
|
Automatically accepts and bypasses all confirmation prompts |
|
Flag |
|
Disables the progress bar, instead logging individual messages per update, useful when running the script as an automated job or similar. |
Zoom/Detail Levels¶
Detail |
Description |
|---|---|
3 |
1 block per pixel |
2 |
2x2 block area per pixel |
1 |
4x4 block area per pixel |
0 |
8x8 block area per pixel |
CLI Grid Options¶
[!NOTE] All options below prefixed with
grid-are only used if the--gridoption is used; otherwise, they do nothing. Color values can be either a hex code (must be preceded by#) or one of 16 color names defined in the HTML 4.01 spec, with the addition of “clear” for full transparency.
Option |
Type |
Default |
Description |
|---|---|---|---|
|
String |
|
The color and thickness in pixels to use for grid lines, separated by space. |
|
String |
(None) |
The string format to use for overlaying grid coordinates, replacing |
|
String/File path, Integer, Color |
(None) |
The name or file path for a font to use for grid coordinate text, as well as the “point” size to use, separated by comma. If left blank (default), Fira Code SemiBold, which is included in |