Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "jimp", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "An image processing library written entirely in JavaScript (i.e. zero external or native dependencies).", | ||
@@ -56,3 +56,3 @@ "main": "dist/index.js", | ||
"@jimp/custom": "^0.6.0", | ||
"@jimp/plugins": "^0.6.0", | ||
"@jimp/plugins": "^0.6.1", | ||
"@jimp/types": "^0.6.0", | ||
@@ -80,3 +80,3 @@ "core-js": "^2.5.7" | ||
}, | ||
"gitHead": "ff78c045c32a9fff55f7fd92f72fa57409126485" | ||
"gitHead": "495fa8852fde16bada8bbdf6433ab2f197a4d35e" | ||
} |
@@ -58,2 +58,28 @@ <div align="center"> | ||
## TypeScript Usage | ||
If you're using this library with TypeScript the method of importing slightly differs from JavaScript. You can import the library with three methods | ||
First of all using [`import = require()`](https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require) method to import it as a `commonJS` module: | ||
```ts | ||
import Jimp = require('jimp'); | ||
``` | ||
Alternatively you can import it with ES6 default import scheme, if you set the `esModuleInterop` compiler flag to `true` in your `tsconfig` | ||
```ts | ||
import Jimp from 'jimp'; | ||
``` | ||
Lastly you can import it with a synthetic default import. This requires setting the `allowSyntheticDefaultImports` compiler option to `true` in your `tsconfig` | ||
```ts | ||
import * as Jimp from 'jimp'; | ||
``` | ||
**Note 1**: `esModuleInterop` implicitly sets `allowSyntheticDefaultImports` to `true` | ||
**Note 2**: `allowSyntheticDefaultImports` nor `esModuleInterop` change the runtime behavior of your code at all. They are just flags that tells TypeScript you need the compatibility they offer. | ||
## Module Build | ||
@@ -94,3 +120,3 @@ | ||
}); | ||
Jimp.read('http://www.example.com/path/to/lenna.jpg') | ||
@@ -103,3 +129,3 @@ .then(image => { | ||
}); | ||
Jimp.read(jimpInstance) | ||
@@ -142,3 +168,3 @@ .then(image => { | ||
Phin parses a `url` and combines it with any options you want. This behavior can be very useful when you need to pass some additional `headers`. Also, you can pass `rejectUnauthorized: false` if you don't require an SSL certificate to be valid (it helps to prevent `unable to verify the first certificate` error). | ||
Phin parses a `url` and combines it with any options you want. This behavior can be very useful when you need to pass some additional `headers`. Also, you can pass `rejectUnauthorized: false` if you don't require an SSL certificate to be valid (it helps to prevent `unable to verify the first certificate` error). | ||
@@ -297,2 +323,13 @@ The convenience method `Jimp.create` also exists. It is just a wrapper around `Jimp.read`. | ||
Where the align mode changes the position of the associated axis as described in the table below. | ||
Align Mode | Axis Point | ||
--- | --- | ||
`Jimp.HORIZONTAL_ALIGN_LEFT` | Positions the x-axis at the left of the image | ||
`Jimp.HORIZONTAL_ALIGN_CENTER` | Positions the x-axis at the center of the image | ||
`Jimp.HORIZONTAL_ALIGN_RIGHT` | Positions the x-axis at the right of the image | ||
`Jimp.VERTICAL_ALIGN_TOP` | Positions the y-axis at the top of the image | ||
`Jimp.VERTICAL_ALIGN_MIDDLE` | Positions the y-axis at the center of the image | ||
`Jimp.VERTICAL_ALIGN_BOTTOM` | Positions the y-axis at the bottom of the image | ||
For example: | ||
@@ -371,3 +408,3 @@ | ||
maxHeight | ||
); // prints 'Hello world!' on an image, middle and center-aligned | ||
); // prints 'Hello world!' on an image, middle and center-aligned, when x = 0 and y = 0 | ||
}); | ||
@@ -374,0 +411,0 @@ ``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
789
3219609
34196
Updated@jimp/plugins@^0.6.1