@jimp/plugin-contain
Advanced tools
Comparing version 1.0.5 to 1.1.0
@@ -5,3 +5,2 @@ { | ||
"rootDir": "../src", | ||
"target": "es2022", | ||
"module": "nodenext", | ||
@@ -8,0 +7,0 @@ "moduleResolution": "nodenext" |
@@ -6,7 +6,9 @@ { | ||
"../src/**/*.cts", | ||
"../src/**/*.tsx" | ||
"../src/**/*.tsx", | ||
"../src/**/*.json" | ||
], | ||
"exclude": [ | ||
"../**/*.test.ts", | ||
"../src/**/*.mts" | ||
"../src/**/*.mts", | ||
"../src/package.json" | ||
], | ||
@@ -13,0 +15,0 @@ "compilerOptions": { |
@@ -6,6 +6,8 @@ { | ||
"../src/**/*.mts", | ||
"../src/**/*.tsx" | ||
"../src/**/*.tsx", | ||
"../src/**/*.json" | ||
], | ||
"exclude": [ | ||
"../**/*.test.ts" | ||
"../**/*.test.ts", | ||
"../src/package.json" | ||
], | ||
@@ -12,0 +14,0 @@ "compilerOptions": { |
@@ -0,1 +1,14 @@ | ||
# v1.1.0 (Sun Sep 01 2024) | ||
#### ⚠️ Pushed to `main` | ||
- upgrade tshy ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
- update more docs ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
#### Authors: 1 | ||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
--- | ||
# v1.0.3 (Sat Aug 31 2024) | ||
@@ -2,0 +15,0 @@ |
{ | ||
"name": "@jimp/plugin-contain", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"repository": "jimp-dev/jimp", | ||
@@ -16,17 +16,17 @@ "scripts": { | ||
"dependencies": { | ||
"@jimp/core": "1.0.5", | ||
"@jimp/plugin-blit": "1.0.5", | ||
"@jimp/plugin-resize": "1.0.5", | ||
"@jimp/types": "1.0.5", | ||
"@jimp/utils": "1.0.5", | ||
"@jimp/core": "1.1.0", | ||
"@jimp/plugin-blit": "1.1.0", | ||
"@jimp/plugin-resize": "1.1.0", | ||
"@jimp/types": "1.1.0", | ||
"@jimp/utils": "1.1.0", | ||
"zod": "^3.22.4" | ||
}, | ||
"devDependencies": { | ||
"@jimp/config-eslint": "1.0.5", | ||
"@jimp/config-typescript": "1.0.5", | ||
"@jimp/config-vitest": "1.0.5", | ||
"@jimp/test-utils": "1.0.5", | ||
"@jimp/config-eslint": "1.1.0", | ||
"@jimp/config-typescript": "1.1.0", | ||
"@jimp/config-vitest": "1.1.0", | ||
"@jimp/test-utils": "1.1.0", | ||
"@vitest/browser": "^1.4.0", | ||
"eslint": "^8.57.0", | ||
"tshy": "^1.12.0", | ||
"tshy": "^3.0.2", | ||
"typescript": "^5.5.4", | ||
@@ -65,3 +65,4 @@ "vite-plugin-node-polyfills": "^0.21.0", | ||
"sideEffects": false, | ||
"gitHead": "44ab95c1875f9f94d993d7a48d66de00115fb4a8" | ||
"module": "./dist/esm/index.js", | ||
"gitHead": "887b0cb53fe5b8d545c8cda82a3db5ef90f18136" | ||
} |
@@ -8,53 +8,2 @@ <div align="center"> | ||
Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. | ||
## Usage | ||
- @param {number} w the width to resize the image to | ||
- @param {number} h the height to resize the image to | ||
- @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment | ||
- @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) | ||
- @param {function(Error, Jimp)} cb (optional) a callback for when complete | ||
```js | ||
import jimp from "jimp"; | ||
async function main() { | ||
const image = await jimp.read("test/image.png"); | ||
image.contain(150, 100); | ||
} | ||
main(); | ||
``` | ||
### Align modes | ||
The following constants can be passed to `image.contain`: | ||
```js | ||
Jimp.HORIZONTAL_ALIGN_LEFT; | ||
Jimp.HORIZONTAL_ALIGN_CENTER; | ||
Jimp.HORIZONTAL_ALIGN_RIGHT; | ||
Jimp.VERTICAL_ALIGN_TOP; | ||
Jimp.VERTICAL_ALIGN_MIDDLE; | ||
Jimp.VERTICAL_ALIGN_BOTTOM; | ||
``` | ||
For example: | ||
```js | ||
image.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP); | ||
image.contain( | ||
250, | ||
250, | ||
Jimp.HORIZONTAL_ALIGN_RIGHT | Jimp.VERTICAL_ALIGN_BOTTOM, | ||
); | ||
``` | ||
Default align mode for `image.contain` is: | ||
```js | ||
Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE; | ||
``` | ||
- [contain](http://jimp-dev.github.io/jimp/api/jimp/classes/jimp#contain) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
395
37253
9
+ Added@jimp/core@1.1.0(transitive)
+ Added@jimp/file-ops@1.1.0(transitive)
+ Added@jimp/plugin-blit@1.1.0(transitive)
+ Added@jimp/plugin-resize@1.1.0(transitive)
+ Added@jimp/types@1.1.0(transitive)
+ Added@jimp/utils@1.1.0(transitive)
- Removed@jimp/core@1.0.5(transitive)
- Removed@jimp/file-ops@1.0.5(transitive)
- Removed@jimp/plugin-blit@1.0.5(transitive)
- Removed@jimp/plugin-resize@1.0.5(transitive)
- Removed@jimp/types@1.0.5(transitive)
- Removed@jimp/utils@1.0.5(transitive)
Updated@jimp/core@1.1.0
Updated@jimp/plugin-blit@1.1.0
Updated@jimp/plugin-resize@1.1.0
Updated@jimp/types@1.1.0
Updated@jimp/utils@1.1.0