{
  "_id": "geotiff-palette",
  "maintainers": [
    {
      "name": "danieljdufour",
      "email": "daniel.j.dufour@gmail.com"
    }
  ],
  "keywords": [
    "geotiff",
    "palette",
    "color",
    "colortable",
    "colormap",
    "rgb"
  ],
  "dist-tags": {
    "latest": "0.1.0"
  },
  "author": {
    "name": "Daniel J. Dufour"
  },
  "_rev": "2-891b19a98158297ab836f61489dc3972",
  "description": "Get the Palette (aka Color Map) for a GeoTIFF",
  "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\n",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/GeoTIFF/geotiff-palette.git"
  },
  "bugs": {
    "url": "https://github.com/GeoTIFF/geotiff-palette/issues"
  },
  "license": "CC0-1.0",
  "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": {
        "integrity": "sha512-qri9e3f3+kMI6zLQgGCaxvD47bTkSwmI73Lw5BZEh+QEJuScRlas2Pv/R37hDpl6eDZEeBbx/7+96zdNWLAOug==",
        "shasum": "dba1ef3ce03b695894ff094cdaf5fdf2b94c5ce7",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/geotiff-palette/-/geotiff-palette-0.0.0.tgz",
        "fileCount": 6,
        "unpackedSize": 12099,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe97a1CRA9TVsSAnZWagAA0g8QAJ1MqoI5MCW7d2sUf8bG\nEXk968LZKQuGDQkeoErAzvW69q0Z7YgF8ZUjbP4F0AKO5VQLrlSG5R4706Dj\n7luTM4srnc8tg8gibRoKPcZVkT9PY5KY5ULVJo/DVLI6bj7oRrCCMylS+5xw\ndhXFECLD1qYIuRtaTlGmADza9qfI7ZZxkcNkGh/l65C0XsjVZLfPczmPn9K9\nk/BEERCI3ZaT6MbESdeZGM6bQTbNNZyGw2/cP3yI2YOi/7qfMhhW5bAZI7wI\n6gSFbIqtQQ0VDIkeH/TwFOJ36WNCFGn2lfmp6yjfxmxyVRwNdOyzSMvfdo7+\ntIXpg4UjVWO2WmnAuNgbc4Njgq2Kdrax+8JL43DEN7DX1yTTEZrVadr/Kxrl\nmozathSLguy74/LCXm1TI0OebFN9BXtiSDgC6rvQeck2+LHeHrvq/x0Nw1VZ\ngrRiec1ytZ7IZ/szqxt95og1nMQJbOVdQVGqfUb7+nWyYvS1RqwdAX3P0cTa\nHqnGvcyke8y4C7dqaWfBhVlq4NrsGwFHLfP1Z0T5qGkdnw3WFDEuXn9R3lHf\n1ksOxlXLI3AtxrKpSKZ53OId7WQ3ErlXb1cu0gKShCd8rf4t2P+lSfEQqjxz\n6o69lr+7mjC2zj5q+VlToLVcBplIsWEpQJn2sIwsGarUoILpONIenqe7ljZM\ndp1i\r\n=ZhU7\r\n-----END PGP SIGNATURE-----\r\n",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQDRyj3yVF24p6EVt2xc/QeJUPtnOg5ZmhyaENhWD5Dq7gIhAKG6ye3cCvBLNk5T9DFtkTWkXroD8ciME0QuSfvL98IX"
          }
        ]
      },
      "maintainers": [
        {
          "name": "danieljdufour",
          "email": "daniel.j.dufour@gmail.com"
        }
      ],
      "_npmUser": {
        "name": "danieljdufour",
        "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
    },
    "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": "https://archive.ito.gov.ir/npm/_packages/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"
      },
      "_npmUser": {
        "name": "danieljdufour",
        "email": "daniel.j.dufour@gmail.com"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "danieljdufour",
          "email": "daniel.j.dufour@gmail.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/geotiff-palette_0.1.0_1661737082732_0.5197735095859324"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "geotiff-palette",
  "time": {
    "created": "2020-06-27T21:14:29.449Z",
    "0.0.0": "2020-06-27T21:14:29.624Z",
    "modified": "2026-05-22T22:15:11.095Z",
    "0.1.0": "2022-08-29T01:38:02.889Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/GeoTIFF/geotiff-palette#readme"
}