diff --git a/README.md b/README.md index b6af3f4..cac5c32 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ of cpu cores. An array of objects containing the sizes and settings we want to resize our image to. For example: - ```js +```js sizes: [{ name: "small", width: 480 @@ -117,117 +117,117 @@ sizes: [{ }] ``` - The settings available are as follows: - - * **width**
- *Type:* `Number` or `String`
- *Version:* 0.0.1 and above +The settings available are as follows: - `width` can either be in pixels or percentages. Please note both width and height need to use the same units, so if width is a percentage value and you wish to specify a height this must also be a percentage. - - The following values are examples of valid widths: `1`, `'1px'`, `'1'`, `'1%'`, `'1.1%'`, `'11.11111%'`, `'111111%'`
- The following values are examples of invalid values for width: `-1`, `1.1`, `1.1px`, `'1.1.1%'`, `'1a'`, `'a1'` +* **width**
+ *Type:* `Number` or `String`
+ *Version:* 0.0.1 and above - * **height**
- *Type:* `Number` or `String`
- *Version:* 0.0.1 and above + `width` can either be in pixels or percentages. Please note both width and height need to use the same units, so if width is a percentage value and you wish to specify a height this must also be a percentage. - `height` can either be in pixels or percentages. Please note both width and height need to use the same units, so if height is a percentage value and you wish to specify a width this must also be a percentage.
- `height` accepts the same values as width. + The following values are examples of valid widths: `1`, `'1px'`, `'1'`, `'1%'`, `'1.1%'`, `'11.11111%'`, `'111111%'`
+ The following values are examples of invalid values for width: `-1`, `1.1`, `1.1px`, `'1.1.1%'`, `'1a'`, `'a1'` - * **name**
- *Type:* `String`
- *Default:* none
- *Version:* 0.0.1 and above +* **height**
+ *Type:* `Number` or `String`
+ *Version:* 0.0.1 and above - If a `name` is specified, then the file will be suffixed with this name. e.g. `my-image-small.jpg`
- If a `name` is not specified, then the file will be suffixed with the width and/or height specified in the size options. e.g. `my-image-320x240.jpg` + `height` can either be in pixels or percentages. Please note both width and height need to use the same units, so if height is a percentage value and you wish to specify a width this must also be a percentage.
+ `height` accepts the same values as width. - * **rename**
- *Type:* `Boolean`
- *Default:* `true`
- *Version:* 0.1.3 and above +* **name**
+ *Type:* `String`
+ *Default:* none
+ *Version:* 0.0.1 and above - If `rename` is set to `false`, then at this size the file will not be renamed, but will instead keep its original name. Suffixes will still be applied. + If a `name` is specified, then the file will be suffixed with this name. e.g. `my-image-small.jpg`
+ If a `name` is not specified, then the file will be suffixed with the width and/or height specified in the size options. e.g. `my-image-320x240.jpg` - * **quality**
- *Type:* `Number`
- *Default:* `100`
- *Available Values:* `1` - `100`
- *Version:* 0.0.4 and above +* **rename**
+ *Type:* `Boolean`
+ *Default:* `true`
+ *Version:* 0.1.3 and above - JPEG format only. The quality of the image, 100 being the highest quality and 1 being the lowest. + If `rename` is set to `false`, then at this size the file will not be renamed, but will instead keep its original name. Suffixes will still be applied. - Please note: In versions below 0.1.0, quality is specified between 0 and 1. +* **quality**
+ *Type:* `Number`
+ *Default:* `100`
+ *Available Values:* `1` - `100`
+ *Version:* 0.0.4 and above - * **suffix**
- *Type:* `String`
- *Default:* none
- *Version:* 0.0.1 and above + JPEG format only. The quality of the image, 100 being the highest quality and 1 being the lowest. - Use `suffix` for retina graphic filenames. e.g. `my-image-320x240_x2.jpg` + Please note: In versions below 0.1.0, quality is specified between 0 and 1. - * **aspectRatio**
- *Type:* `Boolean`
- *Default:* `true`
- *Available Values:* `true` || `false`
- *Version:* 0.1.0 and above +* **suffix**
+ *Type:* `String`
+ *Default:* none
+ *Version:* 0.0.1 and above - Maintains the aspect ratio of the image. The width and the height are treated as maximum values, - so the image is expanded or contracted to fit the width and height value while maintaining the aspect ratio of the image. - If `aspectRatio` is set to `false` and both width and height are specified, the image will be cropped. + Use `suffix` for retina graphic filenames. e.g. `my-image-320x240_x2.jpg` - * **gravity**
- *Type:* `String`
- *Default:* `Center`
- *Available Values:* `NorthWest` || `North` || `NorthEast` || `West` || `Center` || `East` || `SouthWest` || `South` || `SouthEast`
- *Version:* 0.1.0 and above +* **aspectRatio**
+ *Type:* `Boolean`
+ *Default:* `true`
+ *Available Values:* `true` || `false`
+ *Version:* 0.1.0 and above - `gravity` determines the placement of the image within the crop. The default is `Center`. - This setting only applies if an image is cropped. Cropping occurs when the aspectRatio is set to `false` and both width and height are specified. + Maintains the aspect ratio of the image. The width and the height are treated as maximum values, + so the image is expanded or contracted to fit the width and height value while maintaining the aspect ratio of the image. + If `aspectRatio` is set to `false` and both width and height are specified, the image will be cropped. - * **upscale**
- *Type:* `Boolean`
- *Default:* `false`
- *Available Values:* `true` || `false`
- *Version:* 0.1.0 and above. +* **gravity**
+ *Type:* `String`
+ *Default:* `Center`
+ *Available Values:* `NorthWest` || `North` || `NorthEast` || `West` || `Center` || `East` || `SouthWest` || `South` || `SouthEast`
+ *Version:* 0.1.0 and above - If the requested size is larger than the source image should the image be upscaled? + `gravity` determines the placement of the image within the crop. The default is `Center`. + This setting only applies if an image is cropped. Cropping occurs when the aspectRatio is set to `false` and both width and height are specified. - * **sharpen**
- *Type:* `Object`
- *Default:* `null`
- *Version:* 0.1.7 and above +* **upscale**
+ *Type:* `Boolean`
+ *Default:* `false`
+ *Available Values:* `true` || `false`
+ *Version:* 0.1.0 and above. - Sharpen allows you to pass an object with 'sigma' and 'radius' options. The most important factor is the sigma. As it is the real control of the sharpening operation. Sigma can be any floating point value from .1 for practically no sharpening to 3 or more for sever sharpening. 0.5 to 1.0 work well. Radius is the limit of the effect as is the threshold. Radius is only in integer units as that is the way the algorithm works, the larger it is the slower it is. But it should be at a minimum 1 or better still 2 times the sigma. For example: + If the requested size is larger than the source image should the image be upscaled? - sharpen: { - sigma: 1, - radius: 2 - } +* **sharpen**
+ *Type:* `Object`
+ *Default:* `null`
+ *Version:* 0.1.7 and above - * **filter**
- *Type:* `String`
- *Default:* Either `Mitchell` if the image is being enlarged, or supports a palette or matte channel. Otherwise `Lanczos.`
- *Available Values:* `Point` || `Box` || `Triangle` || `Hermite` || `Hanning` || `Hamming` || `Blackman` || `Gaussian` || `Quadratic` || `Cubic` || `Catrom` || `Mitchell` || `Lanczos` || `Bessel` || `Sinc`
- *Version:* 0.1.1 and above. + Sharpen allows you to pass an object with 'sigma' and 'radius' options. The most important factor is the sigma. As it is the real control of the sharpening operation. Sigma can be any floating point value from .1 for practically no sharpening to 3 or more for sever sharpening. 0.5 to 1.0 work well. Radius is the limit of the effect as is the threshold. Radius is only in integer units as that is the way the algorithm works, the larger it is the slower it is. But it should be at a minimum 1 or better still 2 times the sigma. For example: +```js +sharpen: { + sigma: 1, + radius: 2 +} +``` +* **filter**
+ *Type:* `String`
+ *Default:* Either `Mitchell` if the image is being enlarged, or supports a palette or matte channel. Otherwise `Lanczos.`
+ *Available Values:* `Point` || `Box` || `Triangle` || `Hermite` || `Hanning` || `Hamming` || `Blackman` || `Gaussian` || `Quadratic` || `Cubic` || `Catrom` || `Mitchell` || `Lanczos` || `Bessel` || `Sinc`
+ *Version:* 0.1.1 and above. - `filter` effects the resizing operation of an image. Use `Point` for pixel art. [Read more about filters in the ImageMagick documentation](http://www.imagemagick.org/Usage/filter/). + `filter` effects the resizing operation of an image. Use `Point` for pixel art. [Read more about filters in the ImageMagick documentation](http://www.imagemagick.org/Usage/filter/). - * **sample**
- *Type:* `Boolean`
- *Default:* `false`
- *Available Values:* `true` || `false`
- *Version:* 0.1.6 and above. +* **sample**
+ *Type:* `Boolean`
+ *Default:* `false`
+ *Available Values:* `true` || `false`
+ *Version:* 0.1.6 and above. - Sometimes using 'sample' on PNGs may produce the same output with smaller filesizes, sometimes the output will be worse. Use this option to fine tune your images to use 'sample' instead of 'resize' where it is possible to do so. + Sometimes using 'sample' on PNGs may produce the same output with smaller filesizes, sometimes the output will be worse. Use this option to fine tune your images to use 'sample' instead of 'resize' where it is possible to do so. - * **density**
- *Type:* `Number`
- *Default:* `72`
- *Version:* 0.1.7 and above +* **density**
+ *Type:* `Number`
+ *Default:* `72`
+ *Version:* 0.1.7 and above - `density` effects the output resolution, in dpi, of an image. The default is 72 dpi. + `density` effects the output resolution, in dpi, of an image. The default is 72 dpi. * **options.separator**
*Type:* `String`
@@ -243,22 +243,22 @@ sizes: [{ 'units' contains the strings that should be used to represent the size units in an image 'name' when `name` has not been specified. e.g. `my-image-50pcx50pc.jpg` - * **pixel** - *Type:* `String`
- *Default:* ``
- *Version:* 0.1.0 and above +* **pixel** + *Type:* `String`
+ *Default:* _(empty string)_
+ *Version:* 0.1.0 and above - * **percentage** - *Type:* `String`
- *Default:* `pc`
- *Version:* 0.1.0 and above +* **percentage** + *Type:* `String`
+ *Default:* `pc`
+ *Version:* 0.1.0 and above - Please note `%` cannot be used as a valid character in an image name. + Please note `%` cannot be used as a valid character in an image name. - * **multiply** - *Type:* `String`
- *Default:* `x`
- *Version:* 0.1.0 and above +* **multiply** + *Type:* `String`
+ *Default:* `x`
+ *Version:* 0.1.0 and above * **options.customIn** *Type:* `String`