![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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
import {execFile} from 'node:child_process';
import jpegtran from 'jpegtran-bin';
execFile(jpegtran, ['-outfile', 'output.jpg', 'input.jpg'], error => {
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 46,892 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.