|
1 | 1 | # DynmapProcessor
|
2 |
| - |
| 2 | + |
| 3 | +## Getting Started |
| 4 | +Download it from [GitHub Releases](https://github.com/jaoafa/DynmapProcessor/releases), or build it yourself: `./gradlew package` |
| 5 | +Then, `java -jar ./DynmapProcessor-1.0.jar --help` to view help. |
| 6 | +<details> |
| 7 | + <summary>Help output</summary> |
| 8 | + |
| 9 | +``` |
| 10 | +Usage: main [OPTIONS] |
| 11 | +
|
| 12 | + Welcome to Dynmap Processor. |
| 13 | +
|
| 14 | + For more detailed information, please refer to |
| 15 | + https://github.com/jaoafa/DynmapProcessor#readme |
| 16 | +
|
| 17 | +Options: |
| 18 | + -i, --input PATH The directory of tile images. |
| 19 | + -o, --output PATH The directory to output generated images and metadata. |
| 20 | + -c, --cache Whether to allow the use of cached basemap. (Skip |
| 21 | + basemap generation from scratch) |
| 22 | + -z, --zoom INT Specify the zoom level from 0 to 4 (4 by default) |
| 23 | + -g, --grid Whether to enable chunk grid. |
| 24 | + -e, --edit Whether to enable image editing. |
| 25 | + -m, --markers PATH The file path to the JSON file that configures markers. |
| 26 | + -t, --trim TEXT Trim to the specified area. Format: x1,y1,x2,y2 |
| 27 | + -h, --height INT Height of the map image. Using this with the width |
| 28 | + option might cause distortion. |
| 29 | + -w, --width INT Width of the map image. Using this with the height |
| 30 | + option might cause distortion. |
| 31 | + -r, --resize FLOAT Scale up (or down) the output image to the specified |
| 32 | + scale rate. (0<x<1 to scale down, 1<x to scale up) |
| 33 | + --help Show this message and exit |
| 34 | +``` |
| 35 | +</details> |
| 36 | + |
| 37 | +## Options |
| 38 | +| Type | Name | Flags | |
| 39 | +|---------|-----------------------------------------------------|------------------| |
| 40 | +| `PATH` | [Input](#input--i-or---input) | `-i` `--input` | |
| 41 | +| `PATH` | [Output](#output--o-or---output) | `-o` `--output` | |
| 42 | +| `BOOL` | [Cache](#cache--c-or---cache) | `-c` `--cache` | |
| 43 | +| `INT` | [Zoom level](#zoom-level--z-or---zoom-4-by-default) | `-z` `--zoom` | |
| 44 | +| `BOOL` | [Grid](#grid--g-or---grid-false-by-default) | `-g` `--grid` | |
| 45 | +| `BOOL` | [Edit](#edit--e-or---edit-false-by-default) | `-e` `--edit` | |
| 46 | +| `PATH` | [Markers](#markers--m-or---markers) | `-m` `--markers` | |
| 47 | +| `TEXT` | [Trim](#trim--t-or---trim) | `-t` `--trim` | |
| 48 | +| `INT` | [Height](#height-and-width--h-w-or---height--width) | `-h` `--height` | |
| 49 | +| `INT` | [Width](#height-and-width--h-w-or---height--width) | `-w` `--width` | |
| 50 | +| `FLOAT` | [Resize](#resize--r-or---resize-1-by-default) | `-r` `--resize` | |
| 51 | + |
| 52 | +### Input: `-i` or `--input` |
| 53 | +> Example: `-i ./input_images` |
| 54 | +
|
| 55 | +The directory of tile images. |
| 56 | +The directory structure should be the following: |
| 57 | +``` |
| 58 | +input_images |
| 59 | + zoom-0 |
| 60 | + 1_-12.png |
| 61 | + ... |
| 62 | + zoom-1 |
| 63 | + ... |
| 64 | + zoom-2 |
| 65 | + ... |
| 66 | + zoom-3 |
| 67 | + ... |
| 68 | + zoom-4 |
| 69 | + ... |
| 70 | +``` |
| 71 | + |
| 72 | +### Output: `-o` or `--output` |
| 73 | +> Example: `-o ./output_images` |
| 74 | +
|
| 75 | +The directory to output generated images and metadata. |
| 76 | +``` |
| 77 | +output_images |
| 78 | + basemap.png |
| 79 | + map-2023-03-76-19-08-35.png |
| 80 | + map-2023-03-76-19-09-13.png |
| 81 | + metadata.json |
| 82 | +``` |
| 83 | +`basemap.png` is the original unedited map image |
| 84 | +`map-{year}-{month}-{date}-{hour}-{minute}-{second}.png` is the edited image as you specified in [markers.json](#marker-file). How to edit image is [here](#edit--e-or---edit-false-by-default). |
| 85 | +`metadata.json` is the metadata file that stores resolution, central coordinate, and zoom level. |
| 86 | + |
| 87 | +### Cache: `-c` or `--cache` |
| 88 | +> Example: `-c` |
| 89 | +
|
| 90 | +Whether to allow the use of cached basemap. |
| 91 | +If you use this option and basemap.png already exists, Dynmap Processor will skip the new basemap generation. |
| 92 | + |
| 93 | +### Zoom level: `-z` or `--zoom` (4 by default) |
| 94 | +> Example: `-z 3` |
| 95 | +
|
| 96 | +Specify the zoom level from 0 to 4. |
| 97 | +**2~0 are super dangerous.** |
| 98 | + |
| 99 | +### Grid: `-g` or `--grid` (`false` by default) |
| 100 | +> Example: `-g` |
| 101 | +
|
| 102 | +Whether to enable chunk grid. |
| 103 | + |
| 104 | +### Edit: `-e` or `--edit` (`false` by default) |
| 105 | +> Example: `-e` |
| 106 | +
|
| 107 | +Whether to enable image editing. |
| 108 | +The edited image is output like [this](#output--o-or---output). |
| 109 | +**Note that if you forget to add this option, Dynmap Processor will NOT edit the image.** |
| 110 | +Edit options are all the following. |
| 111 | +[Markers](#markers--m-or---markers), [Trim](#trim--t-or---trim), [Height](#height-and-width--h-w-or---height--width), [Width](#height-and-width--h-w-or---height--width), and [Resize](#resize--r-or---resize-1-by-default). |
| 112 | +Note that the final image will be processed in the following order: |
| 113 | +1. draw markers `-m` |
| 114 | +2. trim to a specified area `-t` |
| 115 | +3. scale width and height `-h,-w` |
| 116 | +4. resize the image by the provided rate `-r` |
| 117 | + |
| 118 | +### Markers: `-m` or `--markers` |
| 119 | +> Example: `-m ./markers.json` |
| 120 | +
|
| 121 | +The file path to the JSON file configures markers. |
| 122 | +See [Marker file](#marker-file) |
| 123 | + |
| 124 | +### Trim: `-t` or `--trim` |
| 125 | +> Example: `-t 1000,1000,-1000,-1000` |
| 126 | +
|
| 127 | +Trim to the specified area. |
| 128 | +Format: `x1,y1,x2,y2` |
| 129 | + |
| 130 | +### Height and width: `-h`,`-w` or `--height`,`--width` |
| 131 | +> Example: `-w 1000` / `-h 500` |
| 132 | +
|
| 133 | +Height or width of the map image. |
| 134 | +Using both option at the same time might cause distortion. |
| 135 | + |
| 136 | +### Resize: `-r` or `--resize` (`1` by default) |
| 137 | +> Example: `-r 0.8` |
| 138 | +
|
| 139 | +Scale up (or down) the output image to the specified scale rate. |
| 140 | +`0<x<1` to scale down, `1<x` to scale up. |
| 141 | + |
| 142 | +## Marker file |
| 143 | +JSON Schema: `` //todo url |
| 144 | +<details> |
| 145 | + <summary>Sample file</summary> |
| 146 | + |
| 147 | +```json |
| 148 | +{ |
| 149 | + "markers": [ |
| 150 | + { |
| 151 | + "type": "Area", |
| 152 | + "name": "yuuaCity", |
| 153 | + "coordinates": [ |
| 154 | + { |
| 155 | + "x": 1070, |
| 156 | + "y": -1873 |
| 157 | + }, |
| 158 | + { |
| 159 | + "x": 1070, |
| 160 | + "y": -1764 |
| 161 | + }, |
| 162 | + { |
| 163 | + "x": 704, |
| 164 | + "y": -1764 |
| 165 | + }, |
| 166 | + { |
| 167 | + "x": 704, |
| 168 | + "y": -1430 |
| 169 | + }, |
| 170 | + { |
| 171 | + "x": 1362, |
| 172 | + "y": -1873 |
| 173 | + }, |
| 174 | + { |
| 175 | + "x": 1362, |
| 176 | + "y": -1430 |
| 177 | + } |
| 178 | + ], |
| 179 | + "color": { |
| 180 | + "r": 231, |
| 181 | + "g": 214, |
| 182 | + "b": 243 |
| 183 | + }, |
| 184 | + "overlay": { |
| 185 | + "r": 231, |
| 186 | + "g": 214, |
| 187 | + "b": 243, |
| 188 | + "a": 100 |
| 189 | + } |
| 190 | + }, |
| 191 | + { |
| 192 | + "type": "Line", |
| 193 | + "name": "Sample Line", |
| 194 | + "coordinates": [ |
| 195 | + { |
| 196 | + "x": 511, |
| 197 | + "y": -511 |
| 198 | + }, |
| 199 | + { |
| 200 | + "x": -511, |
| 201 | + "y": 511 |
| 202 | + } |
| 203 | + ], |
| 204 | + "color": { |
| 205 | + "r": 255, |
| 206 | + "g": 161, |
| 207 | + "b": 38 |
| 208 | + }, |
| 209 | + "overlay": { |
| 210 | + "r": 255, |
| 211 | + "g": 161, |
| 212 | + "b": 38, |
| 213 | + "a": 100 |
| 214 | + } |
| 215 | + }, |
| 216 | + { |
| 217 | + "type": "Circle", |
| 218 | + "name": "Sample Circle", |
| 219 | + "radius": 100, |
| 220 | + "coordinates": [ |
| 221 | + { |
| 222 | + "x": 0, |
| 223 | + "y": 31 |
| 224 | + } |
| 225 | + ], |
| 226 | + "color": { |
| 227 | + "r": 187, |
| 228 | + "g": 200, |
| 229 | + "b": 230 |
| 230 | + }, |
| 231 | + "overlay": { |
| 232 | + "r": 187, |
| 233 | + "g": 200, |
| 234 | + "b": 230, |
| 235 | + "a": 100 |
| 236 | + } |
| 237 | + } |
| 238 | + ] |
| 239 | +} |
| 240 | +``` |
| 241 | +</details> |
| 242 | + |
| 243 | + |
| 244 | +## Example |
| 245 | +`java -jar ./DynmapProcessor-1.0.jar -i ./images -o ./output -z 4 -e -m ./markers.json` |
0 commit comments