Skip to content

Commit

Permalink
Cleanup image options in README
Browse files Browse the repository at this point in the history
  • Loading branch information
rprieto committed May 15, 2018
1 parent cd01b88 commit b62c68b
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,30 @@ Processes the image in `source` and creates a new image in `target`.
The image is appropriately converted if needed based on the `target` file extension.
You can specify the following options:

```js
// don't resize, just convert
opts = {}
##### Image size

```js
// proportionally resize the photo to a maximum height
opts = {height: 300}
opts = { height: 300 }

// proportionally resize the photo to a maximum width
opts = {width: 300}
opts = { width: 300 }

// resize and crop the photo to exactly height x width
// the image will not be distorted
opts = {height: 100, width: 100}
opts = { height: 100, width: 100 }
```

// quality of the target image (0-100)
opts = {quality: 80}
##### Image quality

// overlay a watermark on top of the image
```js
// quality between 0 and 100
opts = { quality: 80 }
```

##### Watermark

```js
opts = {
watermark: {
// PNG file with transparency, relative to the working directory
Expand All @@ -71,8 +77,17 @@ opts = {
tile: false
}
}
```

// custom post-processing using GraphicsMagick output arguments
Note: watermarks are not compatible with cropped images.
The `watermark` option will simply be ignored if both width and height are specified.

##### Post-processing

You can specify extra arguments that will be passed to GraphicsMagick.
This only works with [output arguments](https://github.com/aheckmann/gm#custom-arguments).

```js
options = {
args: [
'-unsharp 2 0.5 0.7 0',
Expand All @@ -81,9 +96,6 @@ options = {
}
```

Note: watermarks are not compatible with cropped images.
The `watermark` option will simply be ignored if both width and height are specified.

### .still

```js
Expand Down

0 comments on commit b62c68b

Please sign in to comment.