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

jpegtran-bin

Package Overview
Dependencies
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpegtran-bin

jpegtran (part of libjpeg-turbo) wrapper that makes it seamlessly available as a local dependency on OS X, Linux and Windows. Most commonly used to losslessly minify JPEG images.

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
161K
decreased by-41.7%
Maintainers
3
Weekly downloads
 
Created

What is jpegtran-bin?

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.

What are jpegtran-bin's main functionalities?

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');
});

Other packages similar to jpegtran-bin

Keywords

FAQs

Package last updated on 04 May 2013

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