Skip to content

Commit

Permalink
feat: add resize method to image processor
Browse files Browse the repository at this point in the history
  • Loading branch information
theredrad committed Sep 25, 2021
1 parent 181d2f2 commit 9130be0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

type Processor interface {
CropCenter(img image.Image, width, height int) *image.Image
Resize(img image.Image, width, height int) *image.Image
}

func Decode(name string) (*image.Image, error) {
Expand Down
5 changes: 5 additions & 0 deletions image/imaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ func (i *Imaging) CropCenter(img image.Image, width, height int) *image.Image {
img = imaging.Fill(img, width, height, imaging.Center, imaging.Lanczos)
return &img
}

func (i *Imaging) Resize(img image.Image, width, height int) *image.Image {
img = imaging.Resize(img, width, height, imaging.Lanczos)
return &img
}

0 comments on commit 9130be0

Please sign in to comment.