Update documentation
This commit is contained in:
parent
75027684ec
commit
69b3360d79
45
README.md
45
README.md
@ -3,8 +3,8 @@
|
|||||||
Slice and dice an image, turning it into many equal sized tiles. Useful
|
Slice and dice an image, turning it into many equal sized tiles. Useful
|
||||||
for tools like leaflet.js, to create interactive "slippy" maps.
|
for tools like leaflet.js, to create interactive "slippy" maps.
|
||||||
|
|
||||||
The image is sliced up into equal sized tiles, based on the command line
|
The image is sliced up into equal sized tiles, based on the command line
|
||||||
option `--tile-size` (default 256 pixels).
|
option `--tile-size` (default 256 pixels).
|
||||||
|
|
||||||
Once the tiling is finished, the original is resized to half its current
|
Once the tiling is finished, the original is resized to half its current
|
||||||
dimensions (the orignal file on disk is not touched) and the process repeats.
|
dimensions (the orignal file on disk is not touched) and the process repeats.
|
||||||
@ -19,9 +19,46 @@ the top left tile.
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
slicerdicer --help
|
slicerdicer -help
|
||||||
|
|
||||||
slicerdicer --filename foo.png --tile-size 256 --concurrency 5
|
slicerdicer -filename large_image.png -tile-size 256 -concurrency 5
|
||||||
|
|
||||||
|
## Output filenames
|
||||||
|
|
||||||
|
The destination for the tiles can be changed with the `-basename` and
|
||||||
|
`-path-template` options. The path template must contain 5 placeholders,
|
||||||
|
in the following order:
|
||||||
|
|
||||||
|
* `%s` basename, as per `-basename` (default `tile`)
|
||||||
|
* `%d` zoom level
|
||||||
|
* `%d` 'x' coordinate
|
||||||
|
* `%d` 'y' coordinate
|
||||||
|
* `%d` file format (jpg or png)
|
||||||
|
|
||||||
|
The default template is `%s-%d-%d-%d.%s` which results in a flat structure
|
||||||
|
with all files in the current directory.
|
||||||
|
|
||||||
|
For example, using `-basename map` and
|
||||||
|
`-path-template '%s/zoom-%d/%d-%d.%s'` will result in a file structure like:
|
||||||
|
|
||||||
|
map
|
||||||
|
├── 0
|
||||||
|
│ └── 0-0.png
|
||||||
|
├── 1
|
||||||
|
│ ├── 0-0.png
|
||||||
|
│ └── 1-0.png
|
||||||
|
└── 2
|
||||||
|
├── 0-0.png
|
||||||
|
├── 0-1.png
|
||||||
|
├── 1-0.png
|
||||||
|
├── 1-1.png
|
||||||
|
├── 2-0.png
|
||||||
|
├── 2-1.png
|
||||||
|
├── 3-0.png
|
||||||
|
└── 3-1.png
|
||||||
|
|
||||||
|
All tiles in a directory called `map`, with a second level directory for zoom
|
||||||
|
level, each file named `x-y.png` within that.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
1
main.go
1
main.go
@ -234,7 +234,6 @@ func tileWorker(jobs <-chan tileJob, results chan<- string) {
|
|||||||
writer, err := j.output.CreatePathAndFile(output_filename)
|
writer, err := j.output.CreatePathAndFile(output_filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("could not create path/file: '%s'", err.Error())
|
log.Fatalf("could not create path/file: '%s'", err.Error())
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
if j.format == "png" {
|
if j.format == "png" {
|
||||||
err = png.Encode(writer, cropped)
|
err = png.Encode(writer, cropped)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user