Skip to content

Commit

Permalink
fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
logica0419 committed Aug 31, 2024
1 parent a72999b commit d01701c
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,47 +71,47 @@ func main() {
- Aspect Ratio Preservation
- You can choose from `Ignore` or `Maintain`

```go
dstImg, err := resigif.Resize(
ctx,
srcImg,
width,
height,
resigif.WithAspectRatio(resigif.Maintain),
)

dstImg, err := resigif.Resize(
ctx,
srcImg,
width,
height,
resigif.WithAspectRatio(resigif.Ignore),
)
```

- Changing resizing algorithm
```go
dstImg, err := resigif.Resize(
ctx,
srcImg,
width,
height,
resigif.WithAspectRatio(resigif.Maintain),
)

dstImg, err := resigif.Resize(
ctx,
srcImg,
width,
height,
resigif.WithAspectRatio(resigif.Ignore),
)
```

- Resizing algorithm
- You can use you own resizing algorithm by implementing `ImageResizeFunc` interface and passing it to `WithImageResizeFunc()`
- If you want to use `golang.org/x/image/draw.Scaler`, you can use `FromDrawScaler()` to convert it to `ImageResizeFunc`

```go
dstImg, err := resigif.Resize(
ctx,
srcImg,
width,
height,
resigif.WithImageResizeFunc(resigif.FromDrawScaler(draw.BiLinear)),
)
```
```go
dstImg, err := resigif.Resize(
ctx,
srcImg,
width,
height,
resigif.WithImageResizeFunc(resigif.FromDrawScaler(draw.BiLinear)),
)
```

- Parallelism
- You can control the number of goroutines used for resizing by passing `WithParallel()`

```go
dstImg, err := resigif.Resize(
ctx,
srcImg,
width,
height,
resigif.WithParallel(3),
)
```
- You can control the number of goroutine used for resizing by passing `WithParallel()`

```go
dstImg, err := resigif.Resize(
ctx,
srcImg,
width,
height,
resigif.WithParallel(3),
)
```

0 comments on commit d01701c

Please sign in to comment.