{"id":16235534,"url":"https://github.com/benjaminhoffman/image-optimizer","last_synced_at":"2025-04-08T08:22:33.210Z","repository":{"id":38973149,"uuid":"117910717","full_name":"benjaminhoffman/image-optimizer","owner":"benjaminhoffman","description":"Yet another node module that will compress and resize your images for your mobile website; built on sharp","archived":false,"fork":false,"pushed_at":"2023-07-11T13:25:55.000Z","size":47,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T05:22:59.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/benjaminhoffman.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-18T00:42:14.000Z","updated_at":"2018-01-18T00:58:12.000Z","dependencies_parsed_at":"2024-11-04T08:02:46.188Z","dependency_job_id":"cd9769bc-6bfa-4f7d-b46d-5f2dbc91782e","html_url":"https://github.com/benjaminhoffman/image-optimizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminhoffman%2Fimage-optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminhoffman%2Fimage-optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminhoffman%2Fimage-optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminhoffman%2Fimage-optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjaminhoffman","download_url":"https://codeload.github.com/benjaminhoffman/image-optimizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801590,"owners_count":20998417,"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","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-10-10T13:26:32.905Z","updated_at":"2025-04-08T08:22:33.189Z","avatar_url":"https://github.com/benjaminhoffman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Yet another image compression \u0026 resizing node module.\n\n### Using sharp library, this module will:\n- remove image metadata\n- compress image for web rendering\n- resize image \u0026 create new file name that includes sha1 hash\n\n### Get Started\n\nThe `/dist/manifest.json` file will indicate to this module to skip over files that have already been processed.  It uses the `sha1` hash of the file to know how to proceed.\n\nThis module accepts one parameter: an options object\n\n```javascript\nconst imageOptimizer = require('image-optimizer')\n\nimageOptimizer({\n  // also create webp versions\n  // default: false\n  webp: true,\n\n  // convert file names to all lower case\n  // default: false\n  toLowerCase: true,\n\n  // remove `@2x` from file name\n  // (sometimes appended by Sketch and exported by your design team)\n  // default: false\n  remove2x: true,\n\n  // removes spaces from file names and replaces them\n  // with whatever vale you put here\n  // default: false\n  replaceSpaces: '-'\n})\n```\n\n^^ this will output the following compressed png files:\n- `/dist/example_2232w_23699b50.png`\n- `/dist/example_1116w_23699b50.png`\n- `/dist/example_744w_23699b50.png`\n- `/dist/example_558w_23699b50.png`\n- `/dist/example_446w_23699b50.png`\n\n...and these compressed webp files:\n- `/dist/example_2232w_23699b50.webp`\n- `/dist/example_1116w_23699b50.webp`\n- `/dist/example_744w_23699b50.webp`\n- `/dist/example_558w_23699b50.webp`\n- `/dist/example_446w_23699b50.webp`\n\n### To Do\n- [ ] get `.withoutEnlargement` to work correctly. (currently it creates an image with dimens of the largest version (ie, the original) but with a new file name representing a larger version\n- [ ] only resize smaller, not larger\n- [x] ability to pass in a directory, not just a file name\n- [ ] option to edit the PNG and JPG compression settings\n- [ ] make faster... right now we `writeFileSync` and `readFileSync` but I think this can be refactored to be async and use async/await\n- [ ] write spec\n- [ ] resize count is hard coded to 5, we should make this more dynamic\n- [ ] error handling\n- [ ] logging\n- [ ] linter\n- [ ] connect to a CDN\n\n### Notes\n- `.webp` files have a HUGE saving.  Use the `\u003cpicture\u003e` element to implement\n- need to review Sharp's default settings for compression","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjaminhoffman%2Fimage-optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjaminhoffman%2Fimage-optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjaminhoffman%2Fimage-optimizer/lists"}