Add quality and compressionLevel options for output image. #24

This commit is contained in:
Lovell Fuller
2014-05-10 19:45:12 +01:00
parent 8322b442e0
commit f8338e7c4f
4 changed files with 264 additions and 211 deletions

View File

@@ -94,11 +94,11 @@ sharp('input.jpg').resize(null, 200).progressive().toBuffer(function(err, buffer
```
```javascript
sharp('input.png').resize(300).sharpen().webp(function(err, buffer) {
sharp('input.png').resize(300).sharpen().quality(90).webp(function(err, buffer) {
if (err) {
throw err;
}
// buffer contains sharpened WebP image data (converted from PNG), 300 pixels wide
// buffer contains 300 pixels wide, sharpened, 90% quality WebP image data
});
```
@@ -159,6 +159,18 @@ Perform a mild sharpen of the resultant image. This typically reduces performanc
Use progressive (interlace) scan for JPEG and PNG output. This typically reduces compression performance by 30% but results in an image that can be rendered sooner when decompressed.
### quality(quality)
The output quality to use for lossy JPEG, WebP and TIFF output formats. The default quality is `80`.
`quality` is a Number between 1 and 100.
### compressionLevel(compressionLevel)
An advanced setting for the _zlib_ compression level of the lossless PNG output format. The default level is `6`.
`compressionLevel` is a Number between -1 and 9.
### sequentialRead()
An advanced setting that switches the libvips access method to `VIPS_ACCESS_SEQUENTIAL`. This will reduce memory usage and can improve performance on some systems.