![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@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 817,233 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.