Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
jpegtran-bin
Advanced tools
jpegtran (part of libjpeg-turbo) bin-wrapper that makes it seamlessly available as a local dependency
jpegtran-bin is an npm package that provides a binary wrapper for jpegtran, a command-line utility for optimizing JPEG images. It allows you to perform various operations on JPEG files such as lossless compression, cropping, and rotation.
Lossless Compression
This feature allows you to optimize JPEG images without losing quality. The code sample demonstrates how to use jpegtran-bin to perform lossless compression on an input JPEG file and save the optimized image as output.jpg.
const execFile = require('child_process').execFile;
const jpegtran = require('jpegtran-bin');
execFile(jpegtran, ['-optimize', '-outfile', 'output.jpg', 'input.jpg'], err => {
if (err) {
throw err;
}
console.log('Image optimized');
});
Cropping
This feature allows you to crop a JPEG image. The code sample demonstrates how to use jpegtran-bin to crop a 100x100 pixel area from the input image starting at coordinates (10, 10) and save the cropped image as output.jpg.
const execFile = require('child_process').execFile;
const jpegtran = require('jpegtran-bin');
execFile(jpegtran, ['-crop', '100x100+10+10', '-outfile', 'output.jpg', 'input.jpg'], err => {
if (err) {
throw err;
}
console.log('Image cropped');
});
Rotation
This feature allows you to rotate a JPEG image. The code sample demonstrates how to use jpegtran-bin to rotate the input image by 90 degrees and save the rotated image as output.jpg.
const execFile = require('child_process').execFile;
const jpegtran = require('jpegtran-bin');
execFile(jpegtran, ['-rotate', '90', '-outfile', 'output.jpg', 'input.jpg'], err => {
if (err) {
throw err;
}
console.log('Image rotated');
});
imagemin-jpegtran is a plugin for imagemin that uses jpegtran to optimize JPEG images. It offers similar functionalities to jpegtran-bin but is designed to be used within the imagemin ecosystem, which provides a broader range of image optimization tools.
jpegoptim-bin is an npm package that provides a binary wrapper for jpegoptim, another command-line utility for optimizing JPEG images. It offers similar functionalities to jpegtran-bin, such as lossless compression and optimization, but uses a different underlying tool.
mozjpeg is an npm package that provides a binary wrapper for MozJPEG, a JPEG encoder that aims to improve JPEG compression while maintaining compatibility with the JPEG standard. It offers advanced compression techniques and can achieve smaller file sizes compared to jpegtran-bin.
libjpeg-turbo is a derivative of libjpeg that uses SIMD instructions (MMX, SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64, and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as fast as the unmodified version of libjpeg, all else being equal.
You probably want imagemin-jpegtran
instead.
$ npm install --save jpegtran-bin
var execFile = require('child_process').execFile;
var jpegtran = require('jpegtran-bin');
execFile(jpegtran, ['-outfile', 'output.jpg', 'input.jpg'], function (err) {
console.log('Image minified!');
});
$ npm install --global jpegtran-bin
$ jpegtran --help
MIT © Imagemin
FAQs
jpegtran (part of libjpeg-turbo) bin-wrapper that makes it seamlessly available as a local dependency
The npm package jpegtran-bin receives a total of 183,544 weekly downloads. As such, jpegtran-bin popularity was classified as popular.
We found that jpegtran-bin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.