Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

png-to-jpeg

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

png-to-jpeg

A imagemin-compatible png-to-jpeg converter

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

png-to-jpeg Build Status

A imagemin-compatible png-to-jpeg converter in pure javascript

Install

$ npm install --save png-to-jpeg

Usage

With imagemin:

const imagemin = require('imagemin');
const pngToJpeg = require('png-to-jpeg');

imagemin(['images/*.png'], 'build/images', {
    plugins: [
        pngToJpeg({quality: 90})
    ]
}).then((files) => {
    // Please keep in mind that all files now have the wrong extension
    // You might want to change them manually
    console.log('PNGs converted to JPEGs:', files);
});

Or manually:

const fs = require("fs");
const pngToJpeg = require('png-to-jpeg');

let buffer = fs.readFileSync("./some-file.png");
pngToJpeg({quality: 90})(buffer)
.then(output => fs.writeFileSync("./some-file.jpeg", output));

API

pngToJpeg([options])(buffer)

options
quality

Type: integer
Default: 50

Set a quality preset. Any integer between 1 - 100 is allowed.

buffer

Type: buffer

Buffer to optimize.

License

MIT © Marek Ventur marekventur@gmail.com

Keywords

FAQs

Package last updated on 24 May 2016

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