{"id":20463853,"url":"https://github.com/lorddashme/nodejs-image-squeezer","last_synced_at":"2025-04-13T08:33:31.241Z","repository":{"id":34897567,"uuid":"187963695","full_name":"LordDashMe/nodejs-image-squeezer","owner":"LordDashMe","description":"A simple npm package for image compression powered by FFMPEG.","archived":false,"fork":false,"pushed_at":"2023-04-01T16:03:36.000Z","size":77540,"stargazers_count":16,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T00:12:51.505Z","etag":null,"topics":["ffmpeg","image-processing","javascript","linux","nodejs","optimization","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/LordDashMe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2019-05-22T04:37:03.000Z","updated_at":"2025-03-21T21:43:22.000Z","dependencies_parsed_at":"2024-11-14T12:59:27.368Z","dependency_job_id":null,"html_url":"https://github.com/LordDashMe/nodejs-image-squeezer","commit_stats":{"total_commits":118,"total_committers":2,"mean_commits":59.0,"dds":"0.15254237288135597","last_synced_commit":"d5121684155ac10b6ae02765a2cd9044d189edf1"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordDashMe%2Fnodejs-image-squeezer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordDashMe%2Fnodejs-image-squeezer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordDashMe%2Fnodejs-image-squeezer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LordDashMe%2Fnodejs-image-squeezer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LordDashMe","download_url":"https://codeload.github.com/LordDashMe/nodejs-image-squeezer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248684634,"owners_count":21145112,"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":["ffmpeg","image-processing","javascript","linux","nodejs","optimization","typescript"],"created_at":"2024-11-15T13:13:17.900Z","updated_at":"2025-04-13T08:33:31.214Z","avatar_url":"https://github.com/LordDashMe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NodeJS Image Squeezer\n\nA simple npm package for image compression powered by FFMPEG.\n\n[![Coverage Status](https://img.shields.io/coveralls/LordDashMe/nodejs-image-squeezer/master.svg?style=flat-square)](https://coveralls.io/github/LordDashMe/nodejs-image-squeezer?branch=master) [![NPM version](https://img.shields.io/npm/v/nodejs-image-squeezer.svg?style=flat-square)](https://www.npmjs.com/package/nodejs-image-squeezer)\n\n## Requirement(s)\n\n- Node.js **8.x.x** up to **latest**.\n\n- Operating System: Windows or Linux.\n\n- FFMPEG Binaries or Executable File:\n\n  - To get the latest static build for **Linux**: [Linux FFMPEG Static Build](https://johnvansickle.com/ffmpeg/)\n\n  - For **Windows** you can download it via this link: [Windows FFMPEG Build](https://ffmpeg.zeranoe.com/builds/)\n\n  - As of the moment **MacOS** is not supported.\n\n  - To check the FFMPEG latest build or release please refer to this link: [FFMPEG Main Download Link](https://ffmpeg.org/download.html)\n\n- Other Feature(s):\n\n  - ImageMagick:\n\n    - To use the \"ProressiveJPEG\" class this require the ImageMagick package.\n\n    - To get the latest version [ImageMagick Download Link](https://imagemagick.org/script/download.php)\n\n## Install\n\n### NPM\n\n- Use command ```npm install nodejs-image-squeezer --save```.\n\n### Github Package\n\n- Use command ```npm install @lorddashme/nodejs-image-squeezer```.\n\n  - Currently Github only support scoped npm packages, see: [Publishing a package](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages#publishing-a-package)\n\n## Usage\n\n### FFMPEG\n\n- Basic implementation using Vanilla/Common JavaScript:\n\n```js\n\n// Require the main class of the NodeJS Image Squeezer.\nconst ImageSqueezer = require('nodejs-image-squeezer');\n\n// Initialize the main class.\nconst imgSqueezer = new ImageSqueezer.FFMPEGComppresion();\n\n// Load the necessary requirements and validate\n// if the package fit for the current environment.\nimgSqueezer.load();\n\n// Set the default binaries file.\nimgSqueezer.setBin('/path/to/ffmpeg');\n\n// Provide the source file path of the desire image\n// that will be compress later on.\nimgSqueezer.setSourceFilePath('/path/source-filename');\n\n// Provide the output file path of the compressed image.\nimgSqueezer.setOutputFilePath('/path/output-filename');\n\n// (Optional) This will allow output file path as empty\n// and will use the source file path as the output file path.\nimgSqueezer.allowEmptyOutputFilePath();\n\n// (Optional) To adjust the compression level.\n// COMPRESSION_LEVEL_LOW = 30%\n// COMPRESSION_LEVEL_NORMAL = 70%\n// (Default) COMPRESSION_LEVEL_HIGH = 100%\nimgSqueezer.setCompressionLevel(ImageSqueezer.FFMPEGComppresion.COMPRESSION_LEVEL_NORMAL);\n\n// Prepare all necessary commands before executing\n// the compression process.\nimgSqueezer.build();\n\n// Execute the image compression.\n// Please take note this is an async method.\n// return a Promise\u003cboolean\u003e.\nimgSqueezer.compress();\n\n```\n\n- Below are the simple implementation using **TypeScript**:\n\n```ts\n\nimport ImageSqueezer from 'nodejs-image-squeezer';\n\nconst imgSqueezer = new ImageSqueezer.FFMPEGComppresion();\n\nimgSqueezer.load();\n\nimgSqueezer.setBin('/path/to/ffmpeg');\nimgSqueezer.setSourceFilePath('/path/source-filename');\nimgSqueezer.setOutputFilePath('/path/output-filename');\nimgSqueezer.allowEmptyOutputFilePath();\nimgSqueezer.setCompressionLevel(ImageSqueezer.FFMPEGComppresion.COMPRESSION_LEVEL_NORMAL);\nimgSqueezer.build();\nimgSqueezer.compress();\n\n```\n\n### JPEG Progressive\n\n- **Note:** This function will only work for JPEG format.\n\n- Basic implementation without using superset libraries for Vanilla/Common JavaScript:\n\n```js\n\nconst ImageSqueezer = require('nodejs-image-squeezer');\n\nconst imgSqueezer = new ImageSqueezer.ProgressiveJPEG();\n\nimgSqueezer.load();\nimgSqueezer.setBin('/path/to/convert');\nimgSqueezer.setSourceFilePath('/path/source-filename');\nimgSqueezer.setOutputFilePath('/path/output-filename');\n\n// (Optional) This will allow output file path as empty\n// and will use the source file path as the output file path.\nimgSqueezer.allowEmptyOutputFilePath();\n\nimgSqueezer.build();\n\n// Execute the jpeg progressive optimization.\n// Please take note this is an async method.\n// return a Promise\u003cboolean\u003e.\nimgSqueezer.compress();\n\n```\n\n- Below are the simple implementation using **TypeScript**:\n\n```ts\n\nimport ImageSqueezer from 'nodejs-image-squeezer';\n\nconst imgSqueezer = new ImageSqueezer.ProgressiveJPEG();\n\nimgSqueezer.load();\nimgSqueezer.setBin('/path/to/convert');\nimgSqueezer.setSourceFilePath('/path/source-filename');\nimgSqueezer.setOutputFilePath('/path/output-filename');\nimgSqueezer.allowEmptyOutputFilePath();\nimgSqueezer.build();\nimgSqueezer.compress();\n\n```\n\n## License\n\nThis package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florddashme%2Fnodejs-image-squeezer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Florddashme%2Fnodejs-image-squeezer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florddashme%2Fnodejs-image-squeezer/lists"}