File tree 1 file changed +39
-1
lines changed
1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,45 @@ See [caniuse.com/canvas](http://caniuse.com/canvas)
50
50
51
51
## API
52
52
53
- The API is not yet finalized. Look at the code and expect changes.
53
+ The API is not yet finalized. Look at the code for details and expect changes.
54
+
55
+ ### SmartCrop.crop(image, options, callback)
56
+ Crop image using options and call callback(result) when done.
57
+
58
+ ** image:** anything ctx.drawImage() accepts, usually HTMLImageElement, HTMLCanvasElement or HTMLVideoElement
59
+
60
+ ** options:** see cropOptions
61
+
62
+ ** callback:** function(cropResult)
63
+
64
+ ### cropOptions
65
+
66
+ ** debug:** if true, cropResults will contain a debugCanvas
67
+
68
+ ** minScale:** minimal scale of the crop rect, set to 1.0 to prevent smaller than necessary crops (lowers the risk of chopping things off).
69
+
70
+ ** width:** width of the crop you want to use.
71
+
72
+ ** height:** height of the crop you want to use.
73
+
74
+ There are many more (for now undocumented) options available. Check the [ source] ( smartcrop.js#L32 ) and know that they might change in the future.
75
+
76
+ ### cropResult
77
+ ``` javascript
78
+ {
79
+ topCrop: crop,
80
+ crops: [crop]
81
+ }
82
+ ```
83
+ ### crop
84
+ ``` javascript
85
+ {
86
+ x: 1 ,
87
+ y: 1 ,
88
+ width: 1 ,
89
+ height: 1
90
+ }
91
+ ```
54
92
55
93
## Tests
56
94
You can’t perform that action at this time.
0 commit comments