Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@jimp/plugin-rotate
Advanced tools
@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 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 966,419 weekly downloads. As such, @jimp/plugin-rotate popularity was classified as 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
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.