https://github.com/ahmadawais/resize-optimize-images
๐ Resize and optimize bmp, gif, jpeg, png, & tiff images in Node.js.
https://github.com/ahmadawais/resize-optimize-images
Last synced: 3 months ago
JSON representation
๐ Resize and optimize bmp, gif, jpeg, png, & tiff images in Node.js.
- Host: GitHub
- URL: https://github.com/ahmadawais/resize-optimize-images
- Owner: ahmadawais
- License: mit
- Created: 2019-08-15T07:48:01.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-15T14:14:07.000Z (almost 5 years ago)
- Last Synced: 2025-04-15T01:08:51.716Z (3 months ago)
- Language: JavaScript
- Homepage: https://ahmadawais.com/resize-optimize-images-javascript-node/
- Size: 277 KB
- Stars: 66
- Watchers: 4
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
# resize-optimize-images
[](https://www.npmjs.com/package/resize-optimize-images) [](https://VSCode.pro/?utm_source=GitHubFOSS)
[](https://twitter.com/mrahmadawais/)> ๐ Resize and optimize bmp, gif, jpeg, png, & tiff images in Node.js.
[](./../../)
## Install
```sh
npm install resize-optimize-images
```
[](./../../)
## Usage
```js
const resizeOptimizeImages = require('resize-optimize-images');(async () => {
// Set the options.
const options = {
images: ['path/to/image.jpg', 'path/to/image.png'],
width: 1920,
quality: 90
};// Run the module.
await resizeOptimizeImages(options);
})();
```
[](./../../)
## API
### resizeOptimizeImages(options)
#### โฏ options
Type: `object`
You can specify the options below.
##### images
Type: `Array`
Array of paths to images that you want to resize and optimize.
##### width
Type: `Number`
Default: `1920`A number value of width e.g. 1920.
##### height
Type: `Number`
Optional number value of height e.g. 1080. If you don't pass a height then image is scaled accordingly with width to preserve the aspect ratio.
##### quality
Type: `Number`
Default: `90`Set image quality. `100` being the best quality.
[](changelog.md)
## Changelog
[โฏ Read the changelog here โ](changelog.md)
**KEY**: `๐ฆ NEW`, `๐ IMPROVE`, `๐ FIX`, `๐ DOC`, `๐ RELEASE`, and `โ TEST`
> _I use [Emoji-log](https://github.com/ahmadawais/Emoji-Log), you should try it and simplify your git commits._
[](./../../)
## License & Conduct
- MIT ยฉ [Ahmad Awais](https://twitter.com/MrAhmadAwais/)
- [Code of Conduct](code-of-conduct.md)
[](./../../)
## Connect
ย (follow) To stay up to date on free & open-source software
ย (follow) To get #OneDevMinute daily hot tips & trolls
ย (subscribe) To tech talks & #OneDevMinute videos
ย (read) In-depth & long form technical articles
ย (connect) On the LinkedIn profile y'all
[](./../../)
## Sponsor
Me ([Ahmad Awais](https://twitter.com/mrahmadawais/)) and my incredible wife ([Maedah Batool](https://twitter.com/MaedahBatool/)) are two engineers who fell in love with open source and then with each other. You can read more [about me here](https://ahmadawais.com/about). If you or your company use any of my projects or like what Iโm doing then consider backing me. I'm in this for the long run. An open-source developer advocate.
- ๐ **$9.99/month (recommended)** โฏ [Two cups of Caffรจ latte (coffee) every month โ](https://pay.paddle.com/checkout/540217)
- ๐ **$99.99 (one-time sponsor)** โฏ [Support an hour of open-source code โ](https://pay.paddle.com/checkout/515568)
- ๐ฐ **$49.99 (one-time sponsor)** โฏ [Support an hour of maintenance โ](https://pay.paddle.com/checkout/527253)
- โ๏ธ **$9.99 (one-time sponsor)** โฏ [Lunch/coffee โ](https://pay.paddle.com/checkout/527254)
Or you can back me by checking out my super fun video course. As developers, we spend over 200 Hrs/month with our code editors โ it's only fair to learn your next editor deeply. This course will save you 15-20 hours every month. Become a VSCode Power User โ
[](https://VSCode.pro/?utm_source=GitHubFOSS)
[](https://twitter.com/mrahmadawais/)