Improve entropy-based crop docs based on feedback.

Fix includes to keep MSVC compiler happy.
Additional memory leak suppressions for latest V8.
This commit is contained in:
Lovell Fuller 2016-03-05 13:52:12 +00:00
parent 2034efcf55
commit 185fcfe635
5 changed files with 47 additions and 6 deletions

View File

@ -138,11 +138,14 @@ Possible attributes of `sharp.gravity` are
`north`, `northeast`, `east`, `southeast`, `south`,
`southwest`, `west`, `northwest`, `center` and `centre`.
`sharp.strategy` currently contains only the experimental `entropy`,
which will retain the part of the image with the highest
[Shannon entropy](https://en.wikipedia.org/wiki/Entropy_%28information_theory%29) value.
Possible attributes of the experimental `sharp.strategy` are:
The default option is a `center`/`centre` gravity.
* `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.
The default crop option is a `center`/`centre` gravity.
```javascript
var transformer = sharp()

View File

@ -14,7 +14,7 @@
[#239](https://github.com/lovell/sharp/issues/239)
[@chrisriley](https://github.com/chrisriley)
* Add entropy-based strategy to determine crop region.
* Add entropy-based crop strategy to remove least interesting edges.
[#295](https://github.com/lovell/sharp/issues/295)
[@rightaway](https://github.com/rightaway)

View File

@ -1,3 +1,5 @@
#include <algorithm>
#include <tuple>
#include <vips/vips8>
#include "common.h"

View File

@ -1,6 +1,7 @@
#ifndef SRC_OPERATIONS_H_
#define SRC_OPERATIONS_H_
#include <tuple>
#include <vips/vips8>
using vips::VImage;

View File

@ -248,6 +248,34 @@
...
fun:_ZN2v88internal12_GLOBAL__N_117CreateICUCollatorEPNS0_7IsolateERKN6icu_556LocaleENS0_6HandleINS0_8JSObjectEEE
}
{
leak_v8_CallInterfaceDescriptorData
Memcheck:Leak
match-leak-kinds: possible
...
fun:_ZN2v88internal27CallInterfaceDescriptorData26InitializePlatformSpecificEiPNS0_8RegisterEPNS0_27PlatformInterfaceDescriptorE
}
{
leak_v8_InitializePlatformSpecific14
Memcheck:Leak
match-leak-kinds: possible
...
fun:_ZN2v88internal14LoadDescriptor26InitializePlatformSpecificEPNS0_27CallInterfaceDescriptorDataE
}
{
leak_v8_InitializePlatformSpecific15
Memcheck:Leak
match-leak-kinds: possible
...
fun:_ZN2v88internal15StoreDescriptor26InitializePlatformSpecificEPNS0_27CallInterfaceDescriptorDataE
}
{
leak_v8_Malloced
Memcheck:Leak
match-leak-kinds: possible
...
fun:_ZN2v88internal8Malloced3NewEm
}
# vips__init warnings
{
@ -279,7 +307,7 @@
fun:vips__magick_read_header
}
{
cond_magick_is_palette_image
cond_magick_is_palette_image_get_bands
Memcheck:Cond
fun:IsPaletteImage
...
@ -292,6 +320,13 @@
...
fun:get_bands
}
{
cond_magick_is_palette_image_parse_header
Memcheck:Cond
fun:IsPaletteImage
...
fun:parse_header
}
# glib g_file_read_link
# https://github.com/GNOME/glib/commit/49a5d0f6f2aed99cd78f25655f137f4448e47d92