{"id":16444474,"url":"https://github.com/cviebrock/pixie","last_synced_at":"2026-04-18T17:36:57.225Z","repository":{"id":66288667,"uuid":"104806798","full_name":"cviebrock/pixie","owner":"cviebrock","description":"A simple, on-the-fly image resizing server written in NodeJS.","archived":false,"fork":false,"pushed_at":"2017-09-28T18:14:17.000Z","size":438,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-29T19:59:27.143Z","etag":null,"topics":["image-resizing","nodejs","webserver"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cviebrock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-25T22:06:17.000Z","updated_at":"2017-11-02T21:57:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8164ec1-149c-4a43-ac5c-1c8181c54f58","html_url":"https://github.com/cviebrock/pixie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cviebrock/pixie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cviebrock%2Fpixie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cviebrock%2Fpixie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cviebrock%2Fpixie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cviebrock%2Fpixie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cviebrock","download_url":"https://codeload.github.com/cviebrock/pixie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cviebrock%2Fpixie/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31978610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T17:30:12.329Z","status":"ssl_error","status_checked_at":"2026-04-18T17:29:59.069Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["image-resizing","nodejs","webserver"],"created_at":"2024-10-11T09:24:34.421Z","updated_at":"2026-04-18T17:36:57.220Z","avatar_url":"https://github.com/cviebrock.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pixie\n\nA simple, on-the-fly image resizing server written in NodeJS.\n\n\u003e **NOTE**: Not production-ready yet, and my JS isn't the best so _caveat emptor_.\n\n\n\n## Installation\n\nGet the source code (clone it, download a zip, whatever), then:\n\n``` shell\ncd pixie\ncp pixie.config.json.example pixie.config.json\nyarn\nyarnpkg start\n```\n\nThere are probably some libraries that your OS will need to build the\n[sharp](http://sharp.dimens.io/) image resizing library that Pixie uses.\nSee their docs for more details on what prerequisites you might need \nand how to get them.\n\nAfter starting Pixie, it will log information about any new files it \ngenerates, and any errors, to stdout.\n\n\n\n## Configuration\n\nConfiguration is handled by the `.env` file.\n\n#### PORT\n\nThe port that Pixie will listen on.  Defaults to 3000.\n\n#### PATH\n\nThe root path for images that will be served.  Defaults to the `public` \nsubdirectory of Pixie, but you probably want to set this to the (absolute) \nstorage path of your other application that is using Pixie.\n\n#### HASH_KEY\n\nA random string that is used to generate image hashes, mitigating DOS attacks.  See \n[Hashing](#hashing) below for more details.  If left empty, then no hash \nprotection is enforced.\n\n#### HASH_LENGTH\n\nThe length of the generated hash strings.  Defaults to 8.\n\n\n\n## Requesting Images\n\nAny original file that already exists in the `ROOT` directory will be served \nimmediately (via ExpressJS's `use()` middleware).\n\nA request for a resized image takes the following format:\n\n```\nFILENAME~~WIDTHxHEIGHT[~HASH].EXT[.FORMAT]\n```\n\nSo, for example if the original image is `test_image.jpg`, and you would like a\n160x90 JPEG version of the image, the file would be called:\n\n```\ntest_image~~160x90.jpg\n```\n\nIf you wanted a .webp version of the same image, simply add `.webp` on to the \nfile:\n\n```\ntest_image~~160x90.jpg.webp\n```\n\nIf you want to only specify one of the dimensions (width or height) and have \nPixie resize the image while maintaining aspect ratio, then just set the other \ndimension as zero:\n\n```\ntest_image~~320x0.jpg\n```\n\nGenerated files are served and also stored in the `ROOT` directory, so that \nsubsequent requests to that file can be served immediately without requiring \nresizing again.\n\nIf you have hashing enabled -- which you should! -- then the hash is added to\nthe requested file name: \n\n```\ntest_image~~160x90~60609adb.jpg\ntest_image~~160x90~60609adb.jpg.webp\n```\n\n\n\n## Hashing\n\nYou probably don't want Pixie to generate images of arbitrary sizes.  To prevent\nthis, a hashing algorithm is implemented to verify that the requested image is\nvalid.  The hash is the MD5 of the original file name, the new width and height \nof the resized image (in a `WWWxHHH` formatted string), and the secret `HASH_KEY` \nconfiguration value.  This hash is then truncated to the rightmost number of \ncharacters as defined by `HASH_LENGTH` (simply to keep file names a reasonable \nlength).\n\nSome sample code (in PHP):\n\n```php\ndefine('HASH_KEY', 'SomeSecretString');\ndefine('HASH_LENGTH', 8);\n\n$file = '/path/to/test_image.jpg';\n$newWidth = 160;\n$newHeight = 90;\n\n$hash = md5($file . $newWidth . 'x' . $newHeight . HASH_KEY);\n$hash = substr($hash, -1 * HASH_LENGTH); \n```\n\nAs long as you maintain consistency between the key and length in both Pixie's \nconfiguration and your application, then resized files will have deterministic \nnames.\n\n\n\n## Issues / Planned Features\n\nPixie relies on Node and ExpressJS to deal with race conditions (e.g. thousands \nof requests for the same image that needs to be generated).  This could be an \nissue on high-traffic sites, but Node's single thread system should take care \nof things.  More work is planned in this area.\n\nImage sizes are restricted to 9999x9999 pixels.  This could be made into \nconfigurable options, but those seem like reasonable limits for most cases.\n\nThere is no consideration for restricting images from being up-sized (and thus \npossibly losing some detail).  Again, this could be configurable in future \nversions.\n\n\n## Copyright and License\n\n[Pixie](https://github.com/cviebrock/pixie) was written by \n[Colin Viebrock](http://viebrock.ca) and is released under the \n[MIT License](LICENSE.md).\n\nCopyright (c) 2017 Colin Viebrock\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcviebrock%2Fpixie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcviebrock%2Fpixie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcviebrock%2Fpixie/lists"}