Add experimental 'attention' crop strategy

This commit is contained in:
Lovell Fuller
2016-10-11 21:12:25 +01:00
parent 739178dd74
commit 18b9991fe7
21 changed files with 438 additions and 51 deletions

View File

@@ -175,12 +175,11 @@ Possible attributes of `sharp.gravity` are
`north`, `northeast`, `east`, `southeast`, `south`,
`southwest`, `west`, `northwest`, `center` and `centre`.
Possible attributes of the experimental `sharp.strategy` are:
The experimental strategy-based approach resizes so one dimension is at its target length
then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
* `entropy`: resize so one dimension is at its target size
then repeatedly remove pixels from the edge with the lowest
[Shannon entropy](https://en.wikipedia.org/wiki/Entropy_%28information_theory%29)
until it too reaches the target size.
* `entropy`: focus on the region with the highest [Shannon entropy](https://en.wikipedia.org/wiki/Entropy_%28information_theory%29).
* `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
The default crop option is a `center`/`centre` gravity.

View File

@@ -8,6 +8,9 @@ Requires libvips v8.3.3
* C++11 ABI version is now auto-detected, remove sharp-cxx11 installation flag.
* Add experimental 'attention' crop strategy.
[#295](https://github.com/lovell/sharp/issues/295)
* Include .node extension for Meteor's require() implementation.
[#537](https://github.com/lovell/sharp/issues/537)
[@isjackwild](https://github.com/isjackwild)