Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dayitv89/nodejs-image-parser
Nodejs image parser (convert images as @3x image into desired RGB, compress them, fix the names to snake_case and finally put as 1x,2x, 3x form). Good for react native/ iOS projects.
https://github.com/dayitv89/nodejs-image-parser
Last synced: 9 days ago
JSON representation
Nodejs image parser (convert images as @3x image into desired RGB, compress them, fix the names to snake_case and finally put as 1x,2x, 3x form). Good for react native/ iOS projects.
- Host: GitHub
- URL: https://github.com/dayitv89/nodejs-image-parser
- Owner: dayitv89
- License: mit
- Created: 2018-12-11T11:39:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-11T12:05:12.000Z (about 6 years ago)
- Last Synced: 2024-04-25T16:02:46.546Z (9 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/nodejs-image-parser
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nodejs-image-parser
![https://www.npmjs.com/package/nodejs-image-parser](https://img.shields.io/badge/npm-v1.0.2-red.svg?style=flat)
Nodejs image parser (convert images as @3x image into desired RGB, compress them, fix the names to snake_case and finally put as 1x,2x, 3x form). Good for react native/ iOS projects.
Source Image:
Output: ,,
Source Image:
Output: ,,
### Sample code
```javascript
const ImageParser = require('./ImageParser');const options = { srcDir: './img_src/', destDir: './img_dest/', color: { red: 0, green: 255, blue: 255 } };
ImageParser(options)
.then(() => {
console.log('all done');
})
.catch(err => {
console.log(err);
});
```### Other options for Separate task
#### Parse File Names : Sync return
```javascript
const ImageParser = require('./ImageParser');console.log(ImageParser.parseFileName('./img_dest/', '[email protected]', 1)); // ./img_dest/arrow_next.png
console.log(ImageParser.parseFileName('./img_dest/', '[email protected]', 2)); // ./img_dest/[email protected]
console.log(ImageParser.parseFileName('./img_dest/', '[email protected]', 3)); // ./img_dest/[email protected]
```#### Get file name : Promise based
```javascript
const ImageParser = require('./ImageParser');ImageParser.getFiles('./img_src').then(files => console.log(files)); // [email protected], [email protected]
```#### Change Image : Promise based
```javascript
const ImageParser = require('./ImageParser');
const options = { srcDir: './img_src/', destDir: './img_dest/', file: '[email protected]' color: { red: 0, green: 255, blue: 255 } };
ImageParser.changeImage(options).then(() => console.log('done'));
```#### Compress Images : Promise based
```javascript
const ImageParser = require('./ImageParser');
const options = { destDir: './img_dest/', compressionSize: '50' };
ImageParser.compressImages(options).then(() => console.log('done'));
```####
Voila & Thanks, Author: **Gaurav D. Sharma**