{"_id":"zpl-image","_rev":"6-379bd08c4d0e60534862545a2a14d20d","name":"zpl-image","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"zpl-image","version":"0.1.0","keywords":["image","ZPL","Z64","ZB64","GRF","PNG","JPEG","GIF"],"author":{"name":"Mark Warren"},"license":"MIT","_id":"zpl-image@0.1.0","maintainers":[{"name":"metafloor","email":"npm@metafloor.com"}],"homepage":"https://github.com/metafloor/zpl-image","bugs":{"url":"https://github.com/metafloor/zpl-image/issues"},"dist":{"shasum":"1981930fffbc6911b5047f9fa5b9572e0fcda191","tarball":"https://registry.npmjs.org/zpl-image/-/zpl-image-0.1.0.tgz","fileCount":7,"integrity":"sha512-Swx+/dVTHFAIlfwAqcektq/4Fvywkpaagb7NWeZKi7LsRScNbPWICIgXYrU5ufRZ/wsr8C8xc84QWrPp1VNRHA==","signatures":[{"sig":"MEUCIQDnCmDHEn6/dr6xIzmlZ7tQRb5qUHRLMc18gjmQcKCLPwIgfxlZg4NSb0epA2lGSWhDKXLHgsgk51TV7j00G84OGak=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":231740,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdrdQ2CRA9TVsSAnZWagAARM8QAKBJz6N+CTn3QYyJDkVd\n/PuZgzKf1pkyrIJy/5lpAFQBxNrm2EWIWOPnIgsmmjjS/Wo8eFSk6O2FOCuU\nORZKCcxQw8c3ZK6SIaNK6dSKZKLka/0ZmJSAU8EYEeNptBsd1qFRAl2O+X4P\n7ynzvXtJYm88YkYgQzbwffLLvbb6nPHp6S8wNXwO5rwboqAi+YFDdOiW32EP\nvqTMr4g0r6xpkks8XRukoSIKI6sRKG1CYQIRs4+IYSdTgqIDJTU4BfwLfhzZ\nr0tog3DXg6MZHb8gAlabiuG9zrO3FlN9SZa5rS7y/Rd/3NLfSuDNXD3vbB6L\nXxR5KndvXkXMG1ZgTCrJ2tW1mx59/mImrnFtZuys8+9gpqcB8DHJO3/ArNpj\nYPzbHkJFHf7oUDmYHsbvBxuY2L1CQFRq+VaL/MxqG2VBWhSZS5nL5dckZqLD\nobHEFfnWFFWxjz1hWcx3Xj4FK8S0+EX1PKiJowegkojVYfoWnwnTpsXLx5s/\nkJcWfBLHhQwNWYW1OKKjWVrUgPgHzbZEaGmNHkkrmKR6WktI0aDqV5lVbMM/\n8fEa7T71pq6s8iY4woEPtFgjF69e8oH1azQ7dLOAoH568wZES6/EUBcEAWkh\n+d8aUHLCOxeRefP5p/MkSkG2qM84LNKwQqGKJYf2dDeMSNY9h+fvZDJ9J/x4\nnaEb\r\n=Zwkn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"zpl-image.js","gitHead":"0f261a8aadd43aa30b26a02ca5eb89cbf095c7f2","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"metafloor","email":"npm@metafloor.com"},"repository":{"url":"git+https://github.com/metafloor/zpl-image.git","type":"git"},"_npmVersion":"6.10.2","description":"A pure javascript module that converts PNG, JPEG, and GIF to Z64-encoded GRF bitmaps for use with ZPL.","directories":{"test":"tests"},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/zpl-image_0.1.0_1571673141667_0.5286091977797482","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"zpl-image","version":"0.1.1","keywords":["image","ZPL","Z64","ZB64","GRF","PNG","JPEG","GIF"],"author":{"name":"Mark Warren"},"license":"MIT","_id":"zpl-image@0.1.1","maintainers":[{"name":"metafloor","email":"npm@metafloor.com"}],"homepage":"https://github.com/metafloor/zpl-image","bugs":{"url":"https://github.com/metafloor/zpl-image/issues"},"dist":{"shasum":"a4f0b89282cc187e309aeaebfd7bb8dfda31c37f","tarball":"https://registry.npmjs.org/zpl-image/-/zpl-image-0.1.1.tgz","fileCount":7,"integrity":"sha512-Ofnlwi+sF8ZaHARxa+j0d06K+1oBjpJMnZ/ZFnfzSA3UJKr++PSW1GGdLqda6C5Pgm9rzw7oiPEZbw8qVvbzOQ==","signatures":[{"sig":"MEUCIHjVulPFfA8I/PLjBlrIWNsLOoa78gpzzIVR7CEcsTOVAiEA3QQZxy2QmSiP3Wardr1JrNbqJl1VIiNbP3Z0u6W1QW4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":231767,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdrebDCRA9TVsSAnZWagAAiZgP/3FRqeQhrQYSoJRTsp8r\npTsGDXaovwJV4w2wDkXkdWjgA4p0DP9XojMqxpPAwbuQJYCj25v+2y6jxqz9\nNFwR3HueOPMgwa2A3UfFc9ThPmwG4W5u93z3yYN34eWpkZEIonqE1Ymplz8q\nBZgLM3rSHQgRJAiz+ZD9E0h0F7xjya7glHZBksupsyXARaznxEQrDqBUPhKS\ncuO3WX5KQUlCdliXW7mqT9sw5mhYr7mo936n98PoH1xyPrTLhBhFZn21wbFj\naUHurX382SP1/i1AhNZE68V4uBAVDCA2oq4yeWI1Js0P2u43vSWv5Q7XbuGC\nj2WsCAkL0k7wKZ2YJfNXJVY+KQE2g7BwVXyP08NXogBqlIk36QKBNK5lSc+J\nH+4uKmv7FkUV5f3aWhUGVPD91lsXIShPCiz3F/91GANe6JIKvGelpN8TXzZS\n5FaYxkjH65AmcTy4cWGDyQXSZwH2/iRebcE9voEVFF4vCggCNq0KY7VvACKF\nfGclF6058sIc8q9749c4PmkoMjN11zercDTVbENwIkBKtS80CVSHJFxkUHVO\nr5EUwEcTiMrInjR7giwvwydOWFN5aBhHpdIS4cHpY8h5lZRBAcR0zwNwi6px\nVM2Y2TLomsKTJa/a1MtgZMBsH5ELAebZExRLYfWBHAXecM/GDSMCPBL7kpqj\n+X+n\r\n=Q98M\r\n-----END PGP SIGNATURE-----\r\n"},"main":"zpl-image.js","gitHead":"64515e0086a6b179e2d3569b0658266cea644ae4","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"metafloor","email":"npm@metafloor.com"},"repository":{"url":"git+https://github.com/metafloor/zpl-image.git","type":"git"},"_npmVersion":"6.10.2","description":"A pure javascript module that converts PNG, JPEG, and GIF to Z64-encoded GRF bitmaps for use with ZPL.","directories":{"test":"tests"},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/zpl-image_0.1.1_1571677890994_0.7523072621650941","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"zpl-image","version":"0.1.2","keywords":["image","ZPL","Z64","ZB64","GRF","PNG","JPEG","GIF"],"author":{"name":"Mark Warren"},"license":"MIT","_id":"zpl-image@0.1.2","maintainers":[{"name":"metafloor","email":"npm@metafloor.com"}],"homepage":"https://github.com/metafloor/zpl-image","bugs":{"url":"https://github.com/metafloor/zpl-image/issues"},"dist":{"shasum":"4b966f885ca78bca63ef8b6f34b07e258b09efe2","tarball":"https://registry.npmjs.org/zpl-image/-/zpl-image-0.1.2.tgz","fileCount":7,"integrity":"sha512-00H71+4Qv3JysG6QsbuFaYJsYgSSlThNqPxkfUUyauqgmwjws5jStgmx61eFF/9a1ejBt0w6314Y+CsYgVwpBQ==","signatures":[{"sig":"MEUCIHIDl1k/SQQR7a/lRFikR7FK3Oyz3mQtn4h2M3KLwBY0AiEAtgUTwhLAHqnmjdBYcBtFzW53iP/0DL76nDxKQnmvVIE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":231717,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd1IZLCRA9TVsSAnZWagAACTsQAJ98roky2SiaDNRa/Umc\nPF4B5AQ6+vNx5Ke9VnPueqnPac1o+HosZWeO7dHa4GK2SiBIfH5zEYH/8oSW\njloJZOARSZiWOkAM8i/ipLNkJwr97l+d2jYYWDmrhS5N/16X30XseNnnJhnK\nNg6pgZJz9xRCQB2p35BuwJyGM7+5t6zV6Vda2cxlmz6Qjfi9LEyiHXDVQTzH\nx7BAXz0gqX75demZJsSgyVSathM74zD7xXs6pbXKj+TfmUZehmi/O86ne92z\ndfUGhSVlGSWqeydTVZwxMgUpwipai1j+dtLVz9WKygHeuLZa0tRqQW5n21rG\nk4PK9juW79r0ArvgxsSmIfvnuHy4iqCdlUVi8SOXhXGrcPDQOxlqi3xqtGRa\notYchykXR7ocpHa31t7pp1yHMmf2r0VUbsnBEHTExqixk7zUZZpkq+MN00Xp\nyKu6A28l/EfsEf28Uimg2QcbV/c5QQqBgQLsqMqGw4OF1EpJzhUBQi062iB1\n3uZeKK0hjsxRziow4Bv9NcspeKPBTgkgsMKocnVsiV2drpf5V1AJ7qsmt/Yz\nf+M/c7+vZb7xZXaqpXwVSIku3pG5BERPIGfCLnpM0vuaJEDjWg3tEy2RofHB\ny1pCHyeuE7vt69knVBePK8O2R//4Ckjvg5E0bgCD1xHVvT3qiY2c+tKnXN8G\ngjFZ\r\n=dy3K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"zpl-image.js","gitHead":"fecc6b6e5b3a08d877cf590a85fff7013fc468a8","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"metafloor","email":"npm@metafloor.com"},"repository":{"url":"git+https://github.com/metafloor/zpl-image.git","type":"git"},"_npmVersion":"6.10.2","description":"A pure javascript module that converts PNG, JPEG, and GIF to Z64-encoded GRF bitmaps for use with ZPL.","directories":{"test":"tests"},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/zpl-image_0.1.2_1574209098895_0.06601507677121088","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"zpl-image","version":"0.2.0","keywords":["image","ZPL","Z64","GRF","PNG","JPEG","GIF"],"author":{"name":"Mark Warren"},"license":"MIT","_id":"zpl-image@0.2.0","maintainers":[{"name":"metafloor","email":"npm@metafloor.com"}],"homepage":"https://github.com/metafloor/zpl-image","bugs":{"url":"https://github.com/metafloor/zpl-image/issues"},"dist":{"shasum":"82114ec2f30a26e67f9858aba6981e20eb2263df","tarball":"https://registry.npmjs.org/zpl-image/-/zpl-image-0.2.0.tgz","fileCount":7,"integrity":"sha512-6EqJEvVmfHGAgNt2dIA1t3C8uow/ceinDAzAlAOd3FDGNRN1L+ElY5ddfbwN4eyZykSeqwc0AC8fKus40mkinw==","signatures":[{"sig":"MEUCIQDfsYRqke9feavXl4/tcyErEBw451KEBQorBazz6pK+TwIgMlAE9I2VQ6jSVSYzI4Nmx6p5WGIsW028uyJN84K63zM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":238330,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiRxt7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmphEQ/+PTcX0EPAwTHfAVuW+ZrxzoYmaftORJmYANsF69lax5969RqE\r\nR6E4alF6b/8oTNs59EbWEjVcjHFbJ2CU2wol3fp3YZtNgYpVMfuCKohlR07+\r\nnRREzhdcrcE3GWzagJgFSsbLG97zUDiE+iXqLeMx0I6lKkPP0/JLWIUacJko\r\nSgTuJvsIRzL/9LsL2PCGJHQIUh4V3AEyUy0RRyJSyVvJb3iW7Dd12AWpFXLx\r\npoEOD9hh9Q5luk3LhJWhOik8JwppSAl9wm/jAcT6/VKQnou/DAHQBQPR2w7X\r\nZgA5CPo6KLwmZY757f/hQ3W95B9m9iSg40QFtwmGG/8ouqVBvvpz3D351C65\r\nrdp1ZNttvA+D6VnSa9+ra3zUSkLNKAcgR/l5DqTwdDfhXTK74la4LRdq9oE3\r\nlvn+wbzYdytvltXtDxCPKwizVVcajUBvmRiSnthnxgjUQWqcxPBcmVwZdEwU\r\nl+C22eJQxt1uz+m8xF8cC8R/fAwu9CVEzTtYqoLls+jZNM34oOCCa1DbomnE\r\nTURG2In+k0zJ+vIs78uhmaEc6yQ67/fVQk4tESisOvTNMYbBvDGweazgPiQ+\r\nHbtQtfMbFPNxkm/IgqUJswiEaw+rkASmIiQYwN6IrKwpCHjZ+sQjZ+O8dfQC\r\nsetxxwydowz5U+3vG/i/U8RgdlwRqsdusyA=\r\n=d/O0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"zpl-image.js","gitHead":"491f4d6887294d71dcfa859957d43b3be28ce1e5","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"metafloor","email":"npm@metafloor.com"},"repository":{"url":"git+https://github.com/metafloor/zpl-image.git","type":"git"},"_npmVersion":"6.14.12","description":"A pure javascript module that converts PNG, JPEG, and GIF to Z64-encoded GRF bitmaps for use with ZPL.","directories":{"test":"tests"},"_nodeVersion":"14.16.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/zpl-image_0.2.0_1648827259683_0.4691789920062863","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"zpl-image","version":"0.3.0","description":"A pure javascript module that converts PNG, JPEG, and GIF to Z64-encoded GRF bitmaps for use with ZPL.","main":"zpl-image.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/metafloor/zpl-image.git"},"keywords":["image","ZPL","Z64","GRF","PNG","JPEG","GIF"],"author":{"name":"Mark Warren"},"license":"MIT","bugs":{"url":"https://github.com/metafloor/zpl-image/issues"},"homepage":"https://github.com/metafloor/zpl-image","directories":{"test":"tests"},"gitHead":"2b9b866f865bb3969709c53ac4760c3a5ebbf3bb","_id":"zpl-image@0.3.0","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-+66fiqvre5wjd3t5yI4kRV6rHvW/TNu1RxpnHrDyjwify3yr6jkii2lXEGWAqOoWiEXKA6wM3/x/cnm/E+X9IQ==","shasum":"7d98ab3f278c8f7e59c12302869ee07b61fe143b","tarball":"https://registry.npmjs.org/zpl-image/-/zpl-image-0.3.0.tgz","fileCount":7,"unpackedSize":238601,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICFBD3Xf9MK3FvwkTUbrJ587AEo2rIUhj/M0ytkc7Fi7AiAFEKY86I17XXjt0lLdyP39rSp70imoiUMzhXVNV8GRXw=="}]},"_npmUser":{"name":"metafloor","email":"npm@metafloor.com"},"maintainers":[{"name":"metafloor","email":"npm@metafloor.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/zpl-image_0.3.0_1763416485630_0.7393585849258666"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-21T15:52:21.667Z","modified":"2025-11-17T21:54:46.058Z","0.1.0":"2019-10-21T15:52:21.749Z","0.1.1":"2019-10-21T17:11:31.221Z","0.1.2":"2019-11-20T00:18:19.010Z","0.2.0":"2022-04-01T15:34:19.827Z","0.3.0":"2025-11-17T21:54:45.862Z"},"bugs":{"url":"https://github.com/metafloor/zpl-image/issues"},"author":{"name":"Mark Warren"},"license":"MIT","homepage":"https://github.com/metafloor/zpl-image","keywords":["image","ZPL","Z64","GRF","PNG","JPEG","GIF"],"repository":{"type":"git","url":"git+https://github.com/metafloor/zpl-image.git"},"description":"A pure javascript module that converts PNG, JPEG, and GIF to Z64-encoded GRF bitmaps for use with ZPL.","maintainers":[{"name":"metafloor","email":"npm@metafloor.com"}],"readme":"\n# zpl-image\n\nA pure javascript module that converts images to either Z64-encoded or ACS-encoded GRF bitmaps for use with ZPL.\nThe term ACS (Alternative Compression Scheme) denotes the run-length compression algorithm described in the section\nof the ZPL Reference Manual titled \"Alternative Data Compression Scheme\".  Z64 typically gives better compression\nbut is not available on all printers (especially older ones).  The ACS encoding should work on any printer made\nsince the mid 90s, maybe earlier.\n\nThis module provides the following features:\n\n  - Works in both node.js and modern browsers.\n  - Converts the image to grayscale, then applies a user-supplied blackness\n    threshold to decide which pixels are black.\n  - Optionally removes any empty/white space around the edges of the image.\n  - Optionally rotates the image to one of the orthogonal angles.  This step\n    is often necessary as ZPL does not provide the ability to rotate an image \n    during formatting.\n  - Converts the monochrome image to a GRF bitmap.\n  - Converts the GRF bitmap to either Z64 or ACS encoding.\n  - For Z64, zlib in node.js or pako.js in the browser is used for compression.\n\nThe blackness threshold is specified as an integer between 1 and 99 (think of it as a\ngray percentage).  Pixels darker than the gray% are converted to black.  The default is 50.\n\nRotation is specified as one of the values:\n\n  - `'N'` : No rotation, the default.\n  - `'L'` : Left, 90 degrees counter-clockwise rotation.\n  - `'R'` : Right, 90 degrees clockwise rotation.\n  - `'I'` : Inverted, 180 degrees rotation.\n  - `'B'` : Same as `'L'` but named to match the ZPL notation.\n\nBlackness and rotation are passed via an options object.  For example, to specify\na black threshold of 56% and rotation of -90 degrees, you would pass in:\n\n```javascript\n\t{ black:56, rotate:'L' }\n```\n\nTrimming of empty space around the image is enabled by default.  To disable, specify\nthe option `notrim:true`.\n\n## Demo\n\nIncluded with this module is the file `zpl-image.html`.  You can run it directly\nfrom the browser using the `file://` scheme.  It lets you drag and drop an image\nand then interactively adjust the blackness threshold and rotation.\n\nWhen you are satisfied with the results, select either Z64 or ACS encoding and\nclick the clipboard icon to copy the ZPL.  The ZPL will have the following format:\n\n```\n^FX filename.ext (WxHpx, X-Rotate, XX% Black)^FS\n^GFA,grflen,grflen,rowlen,...ASCII-armored-encoding...\n```\n\n`^FX ... ^FS` is a ZPL comment.\n\n`^GF` is the ZPL command for use-once image rendering (that is, the image is not\nsaved to the printer for later recall by other label formats).\n\nThe rendered image displayed on the page is the actual data decoded and then drawn\nto a canvas.  If you are interested in that bit of functionality, look for `z64ToCanvas`\nand `acsToCanvas` in the `zpl-image.html` file.\n\n## Generic Browser Usage\n\nTo use in the browser, include the following two scripts:\n\n```html\n<script type=\"text/javascript\" src=\"url-path-to/pako.js\"></script>\n<script type=\"text/javascript\" src=\"url-path-to/zpl-image.js\"></script>\n```\n\nThere is a version of pako.js included with this module, but it will not be updated\nfrequently.  It is primarily intended for the demo html file but should be sufficient\nfor production use.\n\n```javascript\n// Works with <img> and <canvas> elements or any element that is\n// compatible with CanvasRenderingContext2D.drawImage().\nlet img = document.getElementById('image');\nlet res = imageToZ64(img);\t// Uses all defaults\n\n// res.length is the uncompressed GRF length.\n// res.rowlen is the GRF row length.\n// res.z64 is the Z64 encoded string.\nlet zpl = `^GFA,${res.length},${res.length},${res.rowlen},${res.z64}`;\n```\n\nAn alternative for when you already have the pixel values in RGBA format\n(either in a Uint8Array or Array of integers clamped to 0..255) is \n`rgbaToZ64()`.  This function is the lower-level converter used\nby both node.js and `imageToZ64()`.  See the node.js section for more details.\n\n```javascript\n// `rgba` is an array of RGBA values.\n// `width` is the width of the image, in pixels.\n// The return value is the same as above.\nlet res = rgbaToZ64(rgba, width, { black:55, rotate:'I' });\n```\n\nThe same interfaces exist for ACS encoding, using the functions `imageToACS()` and\n`rgbaToACS()`.  The returned object from each function is identical to the above, with\nthe exception that the encoded text is in the `acs` property instead of `z64`.\n\n## RequireJS Browser Usage\n\nThis is untested but the module exports are wrapped in a UMD, so in theory you\nshould be able to use this with RequireJS.  The exports are the same as with the\ngeneric browser usage:\n\n```javascript\n// Use the Z64 interface\nconst { imageToZ64, rgbaToZ64 } = require(\"zpl-image\");\n\n// Or the ACS interface\nconst { imageToACS, rgbaToACS } = require(\"zpl-image\");\n```\n\n## Node.js Usage\n\nThe exports from `require(\"zpl-image\")` are the functions `rgbaToZ64()` and\n`rgbaToACS()`.\n\n```javascript\n// The Z64 interface\nconst rgbaToZ64 = require(\"zpl-image\").rgbaToZ64;\n\n// The ACS interface\nconst rgbaToACS = require(\"zpl-image\").rgbaToACS;\n\n```\n\nBoth methods take two or three parameters:\n\n```\nrgbaToZ64(rgba, width [, opts])\nrgbaToACS(rgba, width [, opts])\n```\n\n`rgba` is an array-like object with length equal to `width * height * 4`.\nAn array-like object can be a Buffer, Uint8Array, or Array of integers \nclamped to 0..255.  `width` and `height` are the dimensions of the image, in pixels.\nEach \"quad\" of the RGBA array is structured as:\n\n```javascript\nrgba[i]   // red 0..255\nrgba[i+1] // green 0..255\nrgba[i+2] // blue 0..255\nrgba[i+3] // alpha (0 == fully transparent, 255 == fully opaque)\n```\n\nBecause of the varied nature of the node.js ecosystem, zpl-image does not include\nany dependencies for image modules.  You need to decide what types of images to\nsupport and which image processing package(s) to use.  Below are some simple\nexamples showing three different image modules:\n\n  - [pngjs](https://www.npmjs.com/package/pngjs)\n  - [omggif](https://www.npmjs.com/package/omggif)\n  - [jpeg-js](https://www.npmjs.com/package/jpeg-js)\n\nAll of the following examples show Z64 encoding but can be switched to ACS \nby simply renaming `Z64` to `ACS`.\n\n## pngjs (PNG Conversion)\n\n[pngjs](https://www.npmjs.com/package/pngjs)\n\n```javascript\n// Synchronous pngjs usage\nconst fs = require('fs');\nconst PNG = require('pngjs').PNG;\nconst rgbaToZ64 = require('zpl-image').rgbaToZ64;\n\nlet buf = fs.readFileSync('tux.png');\nlet png = PNG.sync.read(buf);\nlet res = rgbaToZ64(png.data, png.width, { black:53 });\n\n// res.length is the uncompressed GRF length.\n// res.rowlen is the GRF row length.\n// res.z64 is the Z64 encoded string.\nlet zpl = `^GFA,${res.length},${res.length},${res.rowlen},${res.z64}`;\n```\n\n```javascript\n// Async pngjs usage\nconst fs = require('fs');\nconst PNG = require('pngjs').PNG;\nconst rgbaToZ64 = require('zpl-image').rgbaToZ64;\n\nfs.createReadStream('tux.png')\n    .pipe(new PNG({ filterType: 4 }))\n\t.on('parsed', function() {\n\t\t// res is the same as above\n\t\tlet res = rgbaToZ64(this.data, this.width, { black:52, rotate:'R' });\n\t});\n```\n\n## omggif (GIF Conversion)\n\n[omggif](https://www.npmjs.com/package/omggif)\n\n```javascript\nconst fs = require('fs');\nconst GIF = require('omggif');\nconst rgbaToZ64 = require('zpl-image').rgbaToZ64;\n\nlet buf = fs.readFileSync('tux.gif');\nlet gif = new GIF.GifReader(buf);\nlet rgba = Buffer.alloc(gif.width * gif.height * 4);\n\n// Decode only the first frame\ngif.decodeAndBlitFrameRGBA(0, rgba);\n\nlet res = rgbaToZ64(rgba, gif.width, { black:47 });\n```\n\n## jpeg-js (JPEG Conversion)\n\n[jpeg-js](https://www.npmjs.com/package/jpeg-js)\n\n```javascript\nconst fs = require('fs');\nconst JPG = require('jpeg-js');\nconst rgbaToZ64 = require('zpl-image').rgbaToZ64;\n\nlet buf = fs.readFileSync('tux.jpg');\nlet jpg = JPG.decode(buf);\nlet res = rgbaToZ64(jpg.data, jpg.width, { black:51, rotate:'I' });\n```\n\n## MIT License\n\n","readmeFilename":"README.md"}