Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@jimp/plugin-rotate

Package Overview
Dependencies
Maintainers
2
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jimp/plugin-rotate - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

.turbo/turbo-test$colon$browser.log

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# v1.1.2 (Mon Sep 02 2024)
#### 🐛 Bug Fix
- Rotate short circuit [#1317](https://github.com/jimp-dev/jimp/pull/1317) ([@hipstersmoothie](https://github.com/hipstersmoothie))
#### Authors: 1
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
---
# v1.1.0 (Sun Sep 01 2024)

@@ -2,0 +14,0 @@

14

dist/commonjs/index.js

@@ -35,7 +35,2 @@ "use strict";

}
deg %= 360;
if (Math.abs(deg) === 0) {
// no rotation for 0, 360, -360, 720, -720, ...
return;
}
const w = image.bitmap.width;

@@ -107,3 +102,2 @@ const h = image.bitmap.height;

function advancedRotate(image, deg, mode) {
deg %= 360;
const rad = (deg * Math.PI) / 180;

@@ -188,3 +182,9 @@ const cosine = Math.cos(rad);

const parsed = RotateOptionsSchema.parse(options);
const { deg, mode = true } = typeof parsed === "number" ? { deg: parsed } : parsed;
let { deg, mode = true } = typeof parsed === "number" ? { deg: parsed } : parsed;
// No need to do extra rotation
deg %= 360;
// no rotation for 0, 360, -360, 720, -720, ...
if (deg % 360 === 0) {
return image;
}
// use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.

@@ -191,0 +191,0 @@ const matrixRotateAllowed = deg % 90 === 0 &&

@@ -32,7 +32,2 @@ import { ResizeStrategy, methods as resizeMethods } from "@jimp/plugin-resize";

}
deg %= 360;
if (Math.abs(deg) === 0) {
// no rotation for 0, 360, -360, 720, -720, ...
return;
}
const w = image.bitmap.width;

@@ -104,3 +99,2 @@ const h = image.bitmap.height;

function advancedRotate(image, deg, mode) {
deg %= 360;
const rad = (deg * Math.PI) / 180;

@@ -185,3 +179,9 @@ const cosine = Math.cos(rad);

const parsed = RotateOptionsSchema.parse(options);
const { deg, mode = true } = typeof parsed === "number" ? { deg: parsed } : parsed;
let { deg, mode = true } = typeof parsed === "number" ? { deg: parsed } : parsed;
// No need to do extra rotation
deg %= 360;
// no rotation for 0, 360, -360, 720, -720, ...
if (deg % 360 === 0) {
return image;
}
// use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.

@@ -188,0 +188,0 @@ const matrixRotateAllowed = deg % 90 === 0 &&

{
"name": "@jimp/plugin-rotate",
"version": "1.1.1",
"version": "1.1.2",
"repository": "jimp-dev/jimp",

@@ -16,15 +16,15 @@ "scripts": {

"dependencies": {
"@jimp/core": "1.1.1",
"@jimp/plugin-crop": "1.1.1",
"@jimp/plugin-resize": "1.1.1",
"@jimp/types": "1.1.1",
"@jimp/utils": "1.1.1",
"@jimp/core": "1.1.2",
"@jimp/plugin-crop": "1.1.2",
"@jimp/plugin-resize": "1.1.2",
"@jimp/types": "1.1.2",
"@jimp/utils": "1.1.2",
"zod": "^3.22.4"
},
"devDependencies": {
"@jimp/config-eslint": "1.1.1",
"@jimp/config-typescript": "1.1.1",
"@jimp/config-vitest": "1.1.1",
"@jimp/config-eslint": "1.1.2",
"@jimp/config-typescript": "1.1.2",
"@jimp/config-vitest": "1.1.2",
"@jimp/core": "workspace:*",
"@jimp/test-utils": "1.1.1",
"@jimp/test-utils": "1.1.2",
"@types/node": "^20.12.5",

@@ -68,3 +68,3 @@ "@vitest/browser": "^1.4.0",

"module": "./dist/esm/index.js",
"gitHead": "310b6ef10aaddedf85fb326fcc793d29f23c36d8"
"gitHead": "ba9de4df25a2f0e41f11a68c7aa50181a52115cb"
}

@@ -39,9 +39,2 @@ import { ResizeStrategy, methods as resizeMethods } from "@jimp/plugin-resize";

deg %= 360;
if (Math.abs(deg) === 0) {
// no rotation for 0, 360, -360, 720, -720, ...
return;
}
const w = image.bitmap.width;

@@ -52,2 +45,3 @@ const h = image.bitmap.height;

let angle;
switch (deg) {

@@ -131,3 +125,2 @@ // 90 degree & -270 degree are same

) {
deg %= 360;
const rad = (deg * Math.PI) / 180;

@@ -241,4 +234,13 @@ const cosine = Math.cos(rad);

const parsed = RotateOptionsSchema.parse(options);
const { deg, mode = true } =
let { deg, mode = true } =
typeof parsed === "number" ? { deg: parsed } : parsed;
// No need to do extra rotation
deg %= 360;
// no rotation for 0, 360, -360, 720, -720, ...
if (deg % 360 === 0) {
return image;
}
// use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.

@@ -245,0 +247,0 @@ const matrixRotateAllowed =

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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