New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

oenyi

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oenyi

A wrapper for image processing commands that provides a chainable API with asynchronous pipeline of commands.

  • 0.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-53.85%
Maintainers
1
Weekly downloads
 
Created
Source

Oenyi

Build Status

A wrapper for a few gm methods that just provides a convenient and consistent API.

It is built to chain all transformations you need and execute them once you call the exec method, returning the modified image as a Stream.

Getting an oenyi image instance.

  var oenyi = require('oenyi');
  var image = oenyi('/path/to/image');

Convert image to jpeg.

  image.toJPG();

Compress image to a given quality.

  image.compress({quality: 90});

Resize image respecting the original aspect ratio.

Keeps aspect ratio and just scales up or down the image until it fits the provided sizes.

  image.resize({width: 500, height: 255, method: 'contain'});

Resize image to cover or match size and force aspect ratio with no distortion.

Crops and resizes the image to fit the provided sizes and the aspect ratio given by such sizes.

  image.resize({width: 500, height: 500, method: 'cover'});

Execute all commands and return the Buffer with the modified image.

  image.exec(function(err, imageBuffer) {
    // Your code here.
  });

Execute all commands and pipe to a WritableStream;

  var wstream = require('fs').createWriteStream('/path/to/destiny');
  image.pipe(wstream);

Run a complex chained transformation.

Use method chaining to apply many transformations to a single image. Get the image buffer at the end and do with it whatever you want.

  var oenyi = require('oenyi');
  var fs = require('fs');

  oenyi('/path/to/image')
    .toJPG()
    .compress({quality: 80})
    .resize({width: 500, height: 500, method: 'cover'})
    .exec(function(err, imageBuffer) {
      if (err) return console.error(err);

      fs.writeFile('/path/to/destiny', imageBuffer);
    });

Keywords

FAQs

Package last updated on 03 Sep 2015

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