Skip to content

Commit b841c7e

Browse files
committed
fix: don't attempt to resize on zero or negative sizes
1 parent 69c8502 commit b841c7e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/image/file.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ func (f *File) GetSavings() (int64, error) {
8282
func (f *File) Write(c *config.Config) (err error) {
8383
if c.App.Sizes != nil {
8484
for _, r := range c.App.Sizes {
85+
if r.Height <= 0 || r.Width <= 0 {
86+
continue
87+
}
8588
i := imaging.Fill(f.Image, r.Width, r.Height, imaging.Center, imaging.Lanczos)
8689
buf, err := encToBuf(i, c.App)
8790
dest := path.Join(c.App.OutDir, c.App.Prefix+f.Name+"--"+r.String()+c.App.Suffix+"."+c.App.Target)

0 commit comments

Comments
 (0)