{"id":20775019,"url":"https://github.com/qdot/giflib.js","last_synced_at":"2025-07-27T15:10:23.391Z","repository":{"id":18325033,"uuid":"21504117","full_name":"qdot/giflib.js","owner":"qdot","description":"Emscripten'd version of giflib for optimized javascript based gif encoding/decoding","archived":false,"fork":false,"pushed_at":"2014-07-26T19:58:32.000Z","size":412,"stargazers_count":13,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T15:47:14.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://qdot.github.io/giflib.js","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qdot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-04T17:39:55.000Z","updated_at":"2024-02-21T09:38:05.000Z","dependencies_parsed_at":"2022-08-25T11:31:53.013Z","dependency_job_id":null,"html_url":"https://github.com/qdot/giflib.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/qdot/giflib.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdot%2Fgiflib.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdot%2Fgiflib.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdot%2Fgiflib.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdot%2Fgiflib.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qdot","download_url":"https://codeload.github.com/qdot/giflib.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdot%2Fgiflib.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267376344,"owners_count":24077298,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-17T12:34:15.120Z","updated_at":"2025-07-27T15:10:23.124Z","avatar_url":"https://github.com/qdot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# giflib.js\n\nBy Kyle Machulis (qDot)\n\n## Description\n\ngiflib.js is an emscripten'd version of the\n[giflib](http://giflib.sourceforge.net/) library. It allows for\nextremely fast encoding and decoding of static and animated gifs on\nbrowsers that support asm.js.\n\nWhile there have been other libraries that have done gif encoding and\ndecoding, such as [jsgif](http://slbkbs.org/jsgif/),\n[gif.js](http://jnordberg.github.io/gif.js/), and\n[libgif-js](https://github.com/buzzfeed/libgif-js), all of these use\nhand-coded LZW implementations, which end up being far slower than\nusing asm.js (anywhere from 5x-15x depending on image, browser, etc).\nBy running giflib through emscripten, we can now stay up to date with\nthe main native gif decoding library, while enjoying the added benefit\nof asm.js optimizations.\n\nNote that giflib.js is not meant to replace any of the above projects.\nIt is all about making encoding/decoding as fast as possible. The plan\nis actually to submit patches to provide seperate loading paths for\nthem using giflib.js for browsers that allow asm.js.\n\n## Tradeoffs\n\nThis speed doesn't come without a cost, however.\n\ngiflib.js can be quite heavy in terms of both library size (~175k\nungzip'd, roughly 10x-15x the size of other hand written\nencoder/decoders) and memory used (We currently have a 32MB emscripten\nheap in order to deal with large images). Debugging is also more\ndifficult due to the complexity of compiled code.\n\n## Requirements\n\nThe only requirement for using giflib.js is a browser that supports\nasm.js. giflib.js does not provide a fallback path currently, meaning\nthat any browser that doesn't have asm.js capabilities will probably\nen/decode a couple of orders of magnitude slower.\n\nA current build of giflib.js is checked into the repo (release/\ndirectory), so compilation is not required.\n\n## Compilation\n\nHowever, if you do want to compile giflib.js, you should have the most\nrecent version of [emscripten](https://github.com/kripken/emscripten/)\nand the\n[closure compiler](https://developers.google.com/closure/compiler/).\nJust run \"make\" in the repo, and it will download the compatible\nversion of giflib (currently 5.1.0), create an out of source build\ndirectory, and build the javascript libraries. There are other make\ntargets for doing debug builds, tests, etc.\n\n## Example\n\nAn example application is included in the example directory. This\nallows developers to load a local gif using the File API. It will then\nload the gif, and render it to a canvas. If it is animated,\nback/forward controls will be provided.\n\nThis application can also be used as a debugging harness for working\non the library. Simply comment or uncomment the script URLs in the\nheader as needed to test against either the release compiled version\nor the seperate debug files.\n\n## FAQ\n\n* What functions have been added to the native library?\n  * Any C functions that need to be added can be found in the src/\n    directory. Currently, there is a DOpenGifJS() function that is a\n    wrapper around the DOpenGif function. This allows us to set the\n    input reader function in C, and have it compiled into asm.js.\n    While the reader consists solely of a memcpy, having that compiled\n    makes for about a 30% speed up over sending in a function pointer\n    for a non-asm.js reader function. There's also a function for\n    doing the color map to index matching, since that gets about a 40%\n    speedup when done in asm.js.\n\n* The library is big. Can I minify it more?\n  * Not recommended. Heavier minification will only shave off about\n    20k, and on a couple of minifiers I've run it through, it reduces\n    performance by about 50%.\n\n* I'm trying to use gifs that are erroring out due to running out of\nheap. What should I do?\n  * Up the TOTAL_MEMORY value in the makefile and rebuild.\n\n\n## License\n\ngiflib.js is released under the BSD License:\n\nCopyright (c) 2014, Kyle Machulis/Nonpolynomial Labs\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n   * Redistributions of source code must retain the above copyright\n     notice, this list of conditions and the following disclaimer.\n   * Redistributions in binary form must reproduce the above copyright\n     notice, this list of conditions and the following disclaimer in\n     the documentation and/or other materials provided with the\n     distribution.\n   * Neither the name of Nonpolynomial Labs nor the names of its\n     contributors may be used to endorse or promote products derived\n     from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\ngiflib.js is built on top of giflib, which is also under the following\n(MIT) license:\n\nThe GIFLIB distribution is Copyright (c) 1997  Eric S. Raymond\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdot%2Fgiflib.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqdot%2Fgiflib.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdot%2Fgiflib.js/lists"}