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.
A wrapper for image processing commands that provides a chainable API with asynchronous pipeline of commands.
A very simple wrapper for a few image processing methods that just provides:
It is designed to chain the transformations you need and execute them in order once you call the exec
method which gives you a buffer with the image or, if you prefer, when you call the pipe
method which accepts a stream.
Want to see the technical specification? Go here
npm install oenyi
var oenyi = require('oenyi');
var image = oenyi('/path/to/image');
var fs = require('fs');
fs.readFile('/path/to/image', function(err, buffer) {
if (err) {
console.error(err);
return;
}
var image = oenyi(buffer);
});
image.toJPG();
image.compress({quality: 90});
Oenyi gives you three resizing methods: Cover, Contain and Fit. They do what they promise.
It is meant to be used when you want to ensure a maximum size but you want the aspect ratio untouched and if it fits, then the original size as well. This method will only resize down when the image to resize is bigger than the size provided.
// original size w:400, h:400
image.resize({width: 500, height: 255, method: 'contain'}); // => produces size w:255, h:225
// original size w:3000, h:600
image.resize({width: 500, height: 255, method: 'contain'}); // => produces size w:500, h:100
So you want to grow or shrink an image to fit an area as best as it can, but want to keep the aspect ratio and the full image visible? Well, use this method.
// original size w:640, h:2560
image.resize({width: 1024, height: 1024, method: 'fit'}); // => produces size w:256, h:1024
// original size w:5000, h:3000
image.resize({width: 1000, height: 2000, method: 'fit'}); // => produces size w:1000, h:600
Resizes an image to cover or match a size and force a new aspect ratio with no distortion.
// original size w:640, h:2560
image.resize({width: 500, height: 500, method: 'cover'}); // => produces size w:500, h:500
image.exec(function(err, imageBuffer) {
// Your code here.
});
var wstream = require('fs').createWriteStream('/path/to/destiny');
image.pipe(wstream);
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);
});
Because of this creepy video. https://youtu.be/GzobV_qoIcQ You can blame javierbyte for that.
At VoxFeed we wanted to remove image processing related logic from our platform, isolate it and provide a consistent API to make our image related code more bearable...err, readable. So we designed this wrapper.
FAQs
A wrapper for image processing commands that provides a chainable API with asynchronous pipeline of commands.
The npm package oenyi receives a total of 3 weekly downloads. As such, oenyi popularity was classified as not popular.
We found that oenyi 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.