🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

jpeg-js

Package Overview
Dependencies
Maintainers
6
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.4.4
latest
Source
npm
Version published
Weekly downloads
4M
-3.93%
Maintainers
6
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

jpeg

FAQs

Package last updated on 07 Jun 2022

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