Micro-service for file storage and processing written in Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
741 B

package pipelines
import (
"github.com/disintegration/imaging"
"image"
)
type IExecutableStep interface {
Execute(src image.Image) (image.Image, error)
}
// Resize image
type ResizeImageStep struct {
Step
Options struct {
Width int `json:"width"`
Height int `json:"height"`
Upscale bool `json:"upscale"`
} `json:"options"`
}
func (s ResizeImageStep) Execute(src image.Image) (image.Image, error) {
src = imaging.Resize(src, s.Options.Width, s.Options.Height, imaging.Linear)
return src, nil
}
// Compress image
type CompressImageStep struct {
Step
Options struct {
Quality int `json:"quality"`
} `json:"options"`
}
func (s CompressImageStep) Execute(src image.Image) (image.Image, error) {
return src, nil
}