image-clipper
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -16,6 +16,4 @@ var Clipper = require('./clipper'); | ||
case 1: | ||
var sourceType = utils.type(source); | ||
// imageClipper({...}) | ||
if (sourceType === 'Object') { | ||
if (utils.type(source) === 'Object') { | ||
clipper = new Clipper(source); | ||
@@ -22,0 +20,0 @@ } |
{ | ||
"name": "image-clipper", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Node.js module for clip & crop JPEG, PNG, WebP images purely using the native Canvas APIs, excellent compatibility with the Browser & Electron & NW.js (Node-webkit), itself doesn't relies on any image processing libraries.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -93,3 +93,3 @@ # image-clipper | ||
Clipper('/path/to/image.jpg', function() { | ||
.toFile('/path/to/result.jpg', function() { | ||
this.toFile('/path/to/result.jpg', function() { | ||
console.log('saved!'); | ||
@@ -106,3 +106,3 @@ }); | ||
Load image from memory. | ||
Load image from memory. This process will be performed synchronously. | ||
@@ -150,3 +150,3 @@ - **source:** anything ctx.drawImage() accepts, usually HTMLImageElement, HTMLCanvasElement, HTMLVideoElement or [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap). Keep in mind that [origin policies](https://en.wikipedia.org/wiki/Same-origin_policy) apply to the image source, and you may not use cross-domain images without [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). | ||
clipper.image('/path/to/image.jpg', function() { | ||
.toFile('/path/to/result.jpg', function() { | ||
this.toFile('/path/to/result.jpg', function() { | ||
console.log('saved!'); | ||
@@ -206,3 +206,3 @@ }); | ||
Clipper('/path/to/image.jpg', function() { | ||
.toFile('/path/to/result.jpg', function() { | ||
this.toFile('/path/to/result.jpg', function() { | ||
console.log('saved!'); | ||
@@ -366,3 +366,3 @@ }); | ||
Return the current Canvas object. | ||
Return the current instance Canvas object. | ||
@@ -377,3 +377,3 @@ ```js | ||
Configure global properties. Properties changed by this method (same properties configurable through the constructor) will take effect for every instance created after the change. | ||
Configure properties (same properties configurable through the constructor) for global or the instance. | ||
@@ -383,8 +383,10 @@ ```js | ||
Clipper.configure({ | ||
canvas: require('canvas') | ||
canvas: require('canvas') | ||
}); | ||
``` | ||
Or configure instance properties, this will only take effect for current instance and will override the global settings. | ||
Properties changed by the `Clipper.configure` method will take effect for every instance created after the change. | ||
Or you can configure instance properties, below will only take effect for current instance and will override the global settings. | ||
```js | ||
@@ -394,3 +396,3 @@ var Clipper = require('image-clipper'); | ||
clipper.configure({ | ||
canvas: require('canvas') | ||
canvas: require('canvas') | ||
}); | ||
@@ -397,0 +399,0 @@ ``` |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
33915
436
0
572