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

jpeg-js

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpeg-js

A pure javascript JPEG encoder and decoder

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1M
increased by6.99%
Maintainers
3
Weekly downloads
 
Created

What is jpeg-js?

The jpeg-js npm package is a pure JavaScript JPEG encoder and decoder for node.js and browsers. It allows users to decode JPEG images into a bitmap and encode bitmaps into JPEG format. This package is useful for image processing tasks where manipulation of JPEG images is required.

What are jpeg-js's main functionalities?

Decoding JPEG images

This feature allows users to decode JPEG images into a raw image data object, which includes width, height, and an image data buffer.

const jpeg = require('jpeg-js');
const jpegData = fs.readFileSync('image.jpg');
const rawImageData = jpeg.decode(jpegData);

Encoding raw image data to JPEG

This feature allows users to encode raw image data (RGBA format) into a JPEG image. The quality of the output JPEG can be specified.

const jpeg = require('jpeg-js');
const fs = require('fs');
const frameData = Buffer.alloc(width * height * 4);
// ... populate frameData with raw RGBA image data ...
const rawImageData = { data: frameData, width: width, height: height };
const jpegImageData = jpeg.encode(rawImageData, 50); // Quality is 50 out of 100
fs.writeFileSync('new-image.jpg', jpegImageData.data);

Other packages similar to jpeg-js

Keywords

FAQs

Package last updated on 27 Jun 2017

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