{"versions":{"0.0.0":{"name":"geotiff-palette","version":"0.0.0","description":"Get the Palette (aka Color Map) for a GeoTIFF","main":"index.js","scripts":{"test":"ava"},"repository":{"type":"git","url":"git+https://github.com/GeoTIFF/geotiff-palette.git"},"keywords":["geotiff","palette","color","colortable","colormap","rgb"],"author":{"name":"Daniel J. Dufour"},"license":"CC0-1.0","bugs":{"url":"https://github.com/GeoTIFF/geotiff-palette/issues"},"homepage":"https://github.com/GeoTIFF/geotiff-palette#readme","devDependencies":{"ava":"^3.9.0","geotiff":"^1.0.0-beta.12"},"gitHead":"2d524a9bb55604956cb913bde67511aeb1ade851","_id":"geotiff-palette@0.0.0","_nodeVersion":"14.4.0","_npmVersion":"6.14.5","dist":{"shasum":"dba1ef3ce03b695894ff094cdaf5fdf2b94c5ce7","size":4801,"noattachment":false,"tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/geotiff-palette/-/geotiff-palette-0.0.0.tgz","integrity":"sha512-qri9e3f3+kMI6zLQgGCaxvD47bTkSwmI73Lw5BZEh+QEJuScRlas2Pv/R37hDpl6eDZEeBbx/7+96zdNWLAOug=="},"maintainers":[{"name":"anonymous","email":"daniel.j.dufour@gmail.com"}],"_npmUser":{"name":"anonymous","email":"daniel.j.dufour@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/geotiff-palette_0.0.0_1593292469449_0.29265833239401284"},"_hasShrinkwrap":false,"publish_time":1593292469624,"_cnpm_publish_time":1593292469624,"_cnpmcore_publish_time":"2021-12-17T00:02:29.196Z","contributors":[]},"0.1.0":{"name":"geotiff-palette","version":"0.1.0","description":"Get the Palette (aka Color Map) for a GeoTIFF","main":"index.js","types":"index.d.ts","scripts":{"test":"npm run test:js && npm run test:ts","test:js":"node -r require-esm-deasync ./test/test.js","test:ts":"npx ts-node -r require-esm-deasync ./test/test.ts"},"repository":{"type":"git","url":"git+https://github.com/GeoTIFF/geotiff-palette.git"},"keywords":["geotiff","palette","color","colortable","colormap","rgb"],"author":{"name":"Daniel J. Dufour"},"license":"CC0-1.0","bugs":{"url":"https://github.com/GeoTIFF/geotiff-palette/issues"},"homepage":"https://github.com/GeoTIFF/geotiff-palette#readme","devDependencies":{"deasync":"^0.1.28","flug":"^2.3.1","geotiff":"^2.0.5","require-esm-deasync":"^0.1.0"},"gitHead":"b5a7663c00447de3e2b8a1b6f412c324a729814d","_id":"geotiff-palette@0.1.0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-arUVbv/mJ7Dde/by2IQYyUpbYjRM5Cq8vhXvWbyUoRNl24OHR5gIY/eDD0Lt4uQnyuGOgbxciWhfj1X5SRmlwg==","shasum":"77397e99f52e39b9140df1a0197afaf669893af2","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/geotiff-palette/-/geotiff-palette-0.1.0.tgz","fileCount":5,"unpackedSize":11401,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDHQYhBMDyPQg1gf7BtsljLdQVwRRAbyUs66CtbiGflhAIhALHUJ/dmQf7KPhGkfJ8OwmwZoWwtkpVO7PGPf3RYlkPy"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjDBh6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr0EQ/7BLAgz0weH3T3Gl6TerjU2raM2NWqux+V+WvrOkmR6h2tzZ+i\r\nP73RdMZeBMntrzHEt/4JZXB/UEe6WFg23whcd1RnNUNpxX7Rk4MYlDSNuImp\r\nKFGJkRQaxzA0wmqX33ct4+tdeX+8N0FBetkqkmD4kvQn5QHku23mXSr/8XTf\r\nTFtZzV9yN8wbnWZtAuzh8z/cGWGkpVp/BNQLfVQ7E/OgsIKVIIgqckXdGCtj\r\n5ji0hJEya971atF5eBdbIc3g/2nvX1TRzoEuVUcXxepPb+ChXXUqauUM33uD\r\n5oL1GB8bHb83LSXv3a6VfpHW5SP5ldKezNvID7WTeiet4uJFxX2r8dn4iFBs\r\n3H0ON/GxUFW1pPEe7qoWZncRhBNaqMkJhEDburky9BooB4HHghnKOo80+yXj\r\nyzkRs1uvHppS3L8yHvGivoUFub1cPciZv91qxlLOzUcUi4YA7hWL+sumG9pH\r\nTGiOoMEL9wnhF5YGXP92Op+csU+gJmZHovEB9wsTH+5YZTW/w5OKU3vbVB39\r\nvtgiSz0M+ZOw9ri1mt/GLDxX+/fV4bOcGzqtFkodgudRdzzaJrQCYnoEdEqt\r\nIKBVZs5fbzmrV4SpQqTlCDiLeP6r9iuPbYaIUKdZy6CESoUAJTQPW5HAnEfi\r\ni534PltZWWsN9r0vZNkawo3fEg/RV52t1vg=\r\n=rhvL\r\n-----END PGP SIGNATURE-----\r\n","size":4696},"_npmUser":{"name":"anonymous","email":"daniel.j.dufour@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"daniel.j.dufour@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/geotiff-palette_0.1.0_1661737082732_0.5197735095859324"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-08-29T01:38:14.638Z","contributors":[]}},"dist-tags":{"latest":"0.1.0"},"name":"geotiff-palette","time":{"created":"2022-01-26T22:26:41.284Z","modified":"2023-08-01T02:11:53.543Z","0.0.0":"2020-06-27T21:14:29.624Z","0.1.0":"2022-08-29T01:38:02.889Z"},"readme":"# geotiff-palette\nGet the Palette (aka Color Map) for a GeoTIFF\n\n# install\n```bash\nnpm install geotiff-palette\n```\n\n# usage\n## downloaded GeoTIFF\n```\nimport { readFileSync } from 'fs';\nimport { fromArrayBuffer } from 'geotiff';\nimport { getPalette } from 'geotiff-palette';\n\nconst data = readFileSync('image.tif');\nconst arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);\nconst geotiff = await fromArrayBuffer(arrayBuffer);\nconst image = await geotiff.getImage();\nconst palette = await getPalette(image);\nconsole.log(palette);\n```\npalette contains an array of [R, G, B, A] values and looks like this:\n```javascript\n[\n  [ 112, 108, 96, 255 ],  [ 112, 104, 80, 255 ],  [ 104, 104, 104, 255 ],\n  [ 96, 88, 52, 255 ],    [ 104, 104, 112, 255 ], [ 128, 120, 108, 255 ],\n  [ 160, 160, 160, 255 ], [ 152, 152, 144, 255 ], [ 104, 96, 72, 255 ],\n  [ 96, 80, 44, 255 ],    [ 40, 48, 56, 255 ],    [ 152, 144, 144, 255 ],\n  [ 32, 48, 56, 255 ],    [ 120, 120, 96, 255 ],  [ 112, 120, 104, 255 ],\n  // ... 256 total items\n]\n```\n\n## getting a color\nThe index number in the palette corresponds to a raster value. \nFor example, if you have an 8-bit single-band GeoTIFF and you want to get the color for the first pixel with value 130\n```javascript\nconst [ band ] = await image.readRasters();\nconst value = band[0]; // first pixel in the band, which is usually in the top-left of the image\n// value is 130\nconst color = palette[value];\n// color is [ 112, 108, 96, 255 ], which is the same as `rgba(112, 108, 96, 1)`\n```\n\n# support\nPost an issue at https://github.com/GeoTIFF/geotiff-palette or email the package author at daniel.j.dufour@gmail.com","users":{}}