{"_id":"@aleen42/intensity","_rev":"1-5bf8efef8ea51bcace10902887d86adb","name":"@aleen42/intensity","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aleen42/intensity","version":"1.0.0","description":"A lightweight node library for calculating pixel intensity of characters based on Canvas","main":"index.js","scripts":{},"repository":{"type":"git","url":"git+https://github.com/aleen42/intensity.js.git"},"keywords":["pixel","intensity","character"],"author":{"name":"Aleen","email":"aleen42@vip.qq.com"},"license":"MIT","bugs":{"url":"https://github.com/aleen42/intensity.js/issues"},"homepage":"https://github.com/aleen42/intensity.js#readme","dependencies":{"canvas":"^2.7.0"},"gitHead":"11dab5f4f227a699a34b1d86e07f7f3678843c85","_id":"@aleen42/intensity@1.0.0","_nodeVersion":"13.14.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-qAXrWPWyVmokdVZRHxaWd6EjDARGqTNV0HHaTNcERIBHo5PlBBYEZqW4h7irBBtT1JUraPtxsGsYugZBQxtVzw==","shasum":"5871878d70935259a46af996ad22131dac972dd4","tarball":"https://registry.npmjs.org/@aleen42/intensity/-/intensity-1.0.0.tgz","fileCount":5,"unpackedSize":6049,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgiO1RCRA9TVsSAnZWagAADyMQAIgVk5SDj/US7uOtzQVX\nJktP5k51Pj/wuwYGbaHECiPGT0q4JNHZduhiF8jAE78uZD22x/hgOJLV1muO\nOlHl/cKy/shAbsMTBvLPdWXmQgqA8RUgzA2+UIxaPhnmRt7VRK97+OiKBy7r\nDAIsoOgfVw9XorRM7UZy7zSVrgY6AuJS3JUQHy+sv2lOKvJBXBRDc4L5Wurk\nHi0DaRdfB46xyhgE+RxgS/gtWVw9JRGSLPvIT/dFH7OM9iM4LtvkLV4h/o6l\nDeBdSXC9+cpehVqB/79JIMxEKPaGuaVfaVATjdk9jGLwEgkthhn/5RHU5V/X\nzHrVd/mOB5IwPjvpk3bVciztyDM0BXw3LlZm9p8dZapyR8mlbSy7oyTdCuJm\nkDzRs0GNY1IGvna2VYVWwCT8N3vzpaV7SUiA83GcSb9YKxr3BVskaP+IzKh/\n1nNO5c2ZQsu5WXpAHrd2wYv19jZC4TEimdLEwkI2+TgcpJdkNFqjHBr1XZ9u\nciDKbTiC+Lgf6ijvYdCQbUW1gQiVncb0McEgVSIqfbfFpu1LudR7UDcIqrbK\ntRBYd3yURiUw/OSHa0lmtEERhfoUQtIfwmsklcbXqlE5NT5Tc0k+WXdXsrh5\nV/0emof86QVhuqJpOE4WaXlYiaIBbiI34FQvwhx4kIBEdwfbMBvJfdYXzMFn\nJVwa\r\n=u7pB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC5RQocACK3Bty68FZlG3PsYipfBmxLEj5eCJUdRu5nmwIgLPZamB0rVhyuK3Mo9qQ1cIV6F6gL/x95PCLNFf7dcnY="}]},"_npmUser":{"name":"aleen42","email":"aleen42@vip.qq.com"},"directories":{},"maintainers":[{"name":"aleen42","email":"aleen42@vip.qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/intensity_1.0.0_1619586385318_0.45611611866214186"},"_hasShrinkwrap":false}},"time":{"created":"2021-04-28T05:06:25.277Z","1.0.0":"2021-04-28T05:06:25.472Z","modified":"2022-04-04T12:36:59.102Z"},"maintainers":[{"name":"aleen42","email":"aleen42@vip.qq.com"}],"description":"A lightweight node library for calculating pixel intensity of characters based on Canvas","homepage":"https://github.com/aleen42/intensity.js#readme","keywords":["pixel","intensity","character"],"repository":{"type":"git","url":"git+https://github.com/aleen42/intensity.js.git"},"author":{"name":"Aleen","email":"aleen42@vip.qq.com"},"bugs":{"url":"https://github.com/aleen42/intensity.js/issues"},"license":"MIT","readme":"## intensity\n\n<p align=\"center\"><img src=\"./logo.png\" alt=\"intensity\" /></p>\n\nThis is a lightweight node library for calculating pixel intensity of characters based on Canvas, and it helps for asciifying pixels with different intensities of words.\n\nIt mainly uses Canvas to draw characters in a fixed area, and sum alpha values by each pixel to calculate the intensity. The width of the fixed area is corresponding to your given text, which means that it is only meaningful to compare two string items with the same length.\n\n### Usages\n\n1. Install the library at first:\n\n    ```bash\n    npm install --save @aleen42/intensity\n    ```\n\n2. Import it and use it to calculate the pixel intensity of a character, a word, or a sentence:\n\n    ```js\n    const intensity = require('@aleen42/intensity');\n    intensity('a'); // => 0.04325019607843137\n    intensity('A'); // => 0.04439529411764706\n    \n    new Array(126).fill('').map((v, i) => String.fromCharCode(i)) // Ascii\n        .filter((v, i) => i >= 32) // filter by visible\n        .sort((a, b) => intensity(a) - intensity(b)) // sort by pixel intensity\n        .join('');\n    // => \" `-.':_,^\\\"!=><;*/\\\\+c?z7LvrT)(sJiC1xtFYI3|lZyf{}2eSo5unjV[]EwaPA4KXGk6h9UObdqpRHDM8$0#BmQWNg%&@\"\n    ```\n\n### :fuelpump: How to contribute\n\nHave an idea? Found a bug? See [how to contribute](https://wiki.aleen42.com/contribution.html).\n\n### :scroll: License\n\n[MIT](https://wiki.aleen42.com/MIT.html) © aleen42\n","readmeFilename":"README.md"}