New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodejs-image-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90%
Maintainers
1
Weekly downloads
 
Created
Source

nodejs-image-parser

https://www.npmjs.com/package/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.

Source Image:

Output: ,,

Source Image:

Output: ,,

Sample code

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
const ImageParser = require('./ImageParser');

console.log(ImageParser.parseFileName('./img_dest/', 'arrowNext@3x.png', 1)); // ./img_dest/arrow_next.png
console.log(ImageParser.parseFileName('./img_dest/', 'arrowNext@3x.png', 2)); // ./img_dest/arrow_next@2x.png
console.log(ImageParser.parseFileName('./img_dest/', 'arrowNext@3x.png', 3)); // ./img_dest/arrow_next@3x.png
Get file name : Promise based
const ImageParser = require('./ImageParser');

ImageParser.getFiles('./img_src').then(files => console.log(files)); // arrowNext@3x.png, search@3x.png
Change Image : Promise based
const ImageParser = require('./ImageParser');
const options = { srcDir: './img_src/', destDir: './img_dest/', file: 'arrowNext@3x.png' color: { red: 0, green: 255, blue: 255 } };
ImageParser.changeImage(options).then(() => console.log('done'));
Compress Images : Promise based
const ImageParser = require('./ImageParser');
const options = { destDir: './img_dest/', compressionSize: '50' };
ImageParser.compressImages(options).then(() => console.log('done'));

Voila & Thanks, Author: Gaurav D. Sharma

FAQs

Package last updated on 11 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc