A GO library for manipulating and processing images
This package needs at least Go 1.15.6
go get -u github.com/rayne22/file-processorEasy right...
Import package using
import "github.com/rayne22/file-processor/process"process.ResizeImageproduces a scaled image based on the width and height provided using the interpolation. If there is need to preserve the aspect ratio, the width or height can be set to 0.
type UploadedImage struct {
Path string `json:"path"`
ImageName string `json:"image_name"`
Width uint `json:"width"`
Height uint `json:"height"`
Request multipart.File
ImageHeader *multipart.FileHeader
}func (u *UploadedImage) ResizeImage() string processor := process.UploadedImage{} //Initializing the Struct
processor.Height = 200 // Adding height
processor.Width = 200 // Adding width
processor.Path = "temp" // Adding temporary image storage directory
processor.Request = file // If image is being posted through a form, the file is stored in this field
processor.ImageHeader = fileHeader // If image is being posted through a form, the fileHeader is stored in this field
_= processor.ResizeImage() // Function for resizing imagesNB: The above code should be inside a function
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.