Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@jimp/plugin-rotate
Advanced tools
Rotate an image.
@jimp/plugin-rotate is a plugin for the Jimp image processing library that provides functionality to rotate images. It allows users to rotate images by a specified number of degrees, either clockwise or counterclockwise.
Rotate Image
This feature allows you to rotate an image by a specified number of degrees. In this example, the image is rotated by 90 degrees and then saved to a new file.
const Jimp = require('jimp');
Jimp.read('path/to/image.jpg')
.then(image => {
return image.rotate(90) // rotate image by 90 degrees
.write('path/to/rotated-image.jpg'); // save
})
.catch(err => {
console.error(err);
});
Rotate Image with Background Color
This feature allows you to rotate an image by a specified number of degrees and fill the background with a specified color. In this example, the image is rotated by 45 degrees with a white background.
const Jimp = require('jimp');
Jimp.read('path/to/image.jpg')
.then(image => {
return image.rotate(45, false, 0xFFFFFFFF) // rotate image by 45 degrees with white background
.write('path/to/rotated-image.jpg'); // save
})
.catch(err => {
console.error(err);
});
Sharp is a high-performance image processing library that supports a wide range of image transformations, including rotation. It is known for its speed and efficiency, making it a popular choice for server-side image processing. Compared to @jimp/plugin-rotate, Sharp offers more advanced features and better performance.
GraphicsMagick (gm) is a powerful image processing library that provides a wide range of image manipulation capabilities, including rotation. It is a wrapper for the GraphicsMagick and ImageMagick tools, which are well-known for their robustness and versatility. Compared to @jimp/plugin-rotate, gm offers more comprehensive image processing functionalities.
lwip is a lightweight image processing library that supports basic image transformations, including rotation. It is designed to be simple and easy to use, making it suitable for small-scale image processing tasks. Compared to @jimp/plugin-rotate, lwip is more lightweight but may lack some of the advanced features offered by Jimp.
Rotate an image.
Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.
import jimp from "jimp";
async function main() {
const image = await jimp.read("test/image.png");
image.rotate(90);
}
main();
FAQs
Unknown package
The npm package @jimp/plugin-rotate receives a total of 0 weekly downloads. As such, @jimp/plugin-rotate popularity was classified as not popular.
We found that @jimp/plugin-rotate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.