{"id":15646437,"url":"https://github.com/martinheidegger/mapslice","last_synced_at":"2025-10-17T05:13:44.465Z","repository":{"id":12305060,"uuid":"14936738","full_name":"martinheidegger/mapslice","owner":"martinheidegger","description":"Slices a given image into tiles to be used for a interactive map display. (including command-line tool)","archived":false,"fork":false,"pushed_at":"2024-10-14T05:50:14.000Z","size":2662,"stargazers_count":50,"open_issues_count":9,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-19T12:11:23.580Z","etag":null,"topics":["image-processing","maps","tiles"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinheidegger.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-04T21:45:25.000Z","updated_at":"2024-12-20T02:56:33.000Z","dependencies_parsed_at":"2024-06-21T13:13:43.992Z","dependency_job_id":"d0b0fd77-0c79-4bcf-ad0e-012138a01d03","html_url":"https://github.com/martinheidegger/mapslice","commit_stats":{"total_commits":93,"total_committers":4,"mean_commits":23.25,"dds":"0.053763440860215006","last_synced_commit":"09a3718473062d8f8c3d6bdbe6f7f7eeb0b40774"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/martinheidegger/mapslice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fmapslice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fmapslice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fmapslice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fmapslice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinheidegger","download_url":"https://codeload.github.com/martinheidegger/mapslice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinheidegger%2Fmapslice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260852095,"owners_count":23072587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-processing","maps","tiles"],"created_at":"2024-10-03T12:12:52.909Z","updated_at":"2025-10-17T05:13:44.387Z","avatar_url":"https://github.com/martinheidegger.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mapslice - Image crop \u0026 slice tool\n\n[![Build Status](https://github.com/martinheidegger/mapslice/workflows/Node.js%20CI/badge.svg)](https://github.com/martinheidegger/mapslice/actions?query=workflow%3A%22Node.js+CI%22)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\nmapslice is a tool to cut images into slices of various zoom levels for use in interactive maps.\n\nJavascript tools for high-performant viewing of huge images are plenty available, yet cropping and slicing images can be a pain with the given tools.\nmapslice automatically detects which tile-sizes your input-material supports and creates all possible tiles to be used by a common javascript map tool\nlike [polymaps](http://polymaps.org/), [kartograph](http://kartograph.org/) or [PanoJS](http://www.dimin.net/software/panojs/).\n\n## Installation\n\nvia npm:\n\n```bash\n$ npm install mapslice\n```\n\n## Command line\n\nAfter installing the latest [node](http://nodejs.org/), you can use mapslice as a command-line tool by installing it with:\n\n```console\n$ npm install mapslice -g\n```\n\nAlso make sure that you have [GraphicsMagick](http://www.graphicsmagick.org/README.html) or [ImageMagick](http://www.imagemagick.org/script/binary-releases.php) installed and available in your command-line!\n\nOnce the prerequisites are given, run mapslice using:\n\n```console\n$ mapslice -f test.jpg\n```\n\nFor more documentation run mapslice without arguments:\n\n```console\n$ mapslice\n```\n\n\n## Script usage\n\n```JavaScript\nconst MapSlicer = require('mapslice')\n\n// The parameters passed here are equal to the command-line parameters\nconst mapSlicer = new MapSlicer({\n  file: `myImage.jpg`,               // (required) Huge image to slice\n  output: `myImage/{z}/{y}/{x}.png`, // (default: derived from file path) Output file pattern\n  outputFolder: './output',          // (default: derived from file path) Output to be used for. Use either output or outputFolder, not both!\n  tileSize: 512,                     // (default: 256) Tile-size to be used\n  imageMagick: true,                 // (default: false) If (true) then use ImageMagick instead of GraphicsMagick\n  background: '#00000000',           // (default: '#FFFFFFFF') Background color to be used for the tiles. More: http://ow.ly/rsluD\n  tmp: './temp',                     // (default: '.tmp') Temporary directory to be used to store helper files\n  parallelLimit: 3,                  // (default: 5) Maximum parallel tasks to be run at the same time (warning: processes can consume a lot of memory!)\n  minWidth: 200,                     // See explanation about Size detection below\n  skipEmptyTiles: true,              // Skips all the empty tiles\n  bitdepth: 8,                       // (optional) See http://aheckmann.github.io/gm/docs.html#dither\n  dither: true,                      // (optional) See http://aheckmann.github.io/gm/docs.html#bitdepth\n  colors: 128,                       // (optional) See http://aheckmann.github.io/gm/docs.html#colors\n  gm: require('gm'),                 // (optional) Alternative way to specify the GraphicsMagic library\n  signal: new (require('abort-controller'))().signal // (optional) Signal to abort the map slicing process\n  concurrency:1                      // (default: Infinity) Maximum parallel tasks to be run at the same time (warning: processes can consume a lot of memory!)\n})\n\nmapSlicer.on('start', (files, options) =\u003e console.info(`Starting to process ${files} files.`))\nmapSlicer.on('imageSize', (width, height) =\u003e console.info(`Image size: ${width}x${height}`))\nmapSlicer.on('levels', (levels) =\u003e { console.info(`Level Data: ${levels}`) }) // see TypeScript declaration for more details\nmapSlicer.on('warning', err =\u003e console.warn(err))\nmapSlicer.on('progress', (progress, total, current, path)  =\u003e console.info(`Progress: ${Math.round(progress*100)}%`))\nmapSlicer.on('end', () =\u003e console.info('Finished processing slices.') )\nmapSlicer.start().catch(err =\u003e console.error(err))\n\n## Size detection and scaling\n\nTo render the image in its fullest glory, mapslice assumes that you want to preserve the original image-quality and chooses input-size as its starting point from which the quality should be reduced. However: If you have a fixed-size map-user-interface then you might want the smallest image quality to fit this user-interface-design in order to assure that its is beautifully visible. To produce tiles that fit this needs you can use the \"minWidth\" or \"minHeight\" property which fits the map to have its lowest size matching exactly your required size:\n\n```console\n$ mapslice -f test.jpg -w=1000\n```\n\nWill fit the smallest size to be exactly 1000 pixels wide and zoom up from there.\n\n### Note\n\nTo speed up performance mapslice stores a prescaled version of the each zoom-level in a temorary folder and then just crops off of that. These temporary files can become quite big as they are stored with low compression and high quality in sgi files.\n\n## License\n\n[MIT](./LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinheidegger%2Fmapslice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinheidegger%2Fmapslice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinheidegger%2Fmapslice/lists"}