-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change interface of processor to accept image.Image instead of []byte…
… and expose decode and encode implementation
- Loading branch information
1 parent
4b3aa78
commit 52d1902
Showing
5 changed files
with
86 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
package processor | ||
|
||
import "image" | ||
|
||
// Processor interface for performing operations on image bytes | ||
type Processor interface { | ||
// Crop takes an input byte array, width, height and a CropPoint and returns the cropped image bytes or error | ||
Crop(input []byte, width, height int, point CropPoint) ([]byte, error) | ||
// Resize takes an input byte array, width and height and returns the re-sized image bytes or error | ||
Resize(input []byte, width, height int) ([]byte, error) | ||
// Crop takes an image.Image, width, height and a CropPoint and returns the cropped image | ||
Crop(image image.Image, width, height int, point CropPoint) image.Image | ||
// Resize takes an image.Image, width and height and returns the re-sized image | ||
Resize(image image.Image, width, height int) image.Image | ||
// GrayScale takes an input byte array and returns the grayscaled byte array or error | ||
GrayScale(image image.Image) image.Image | ||
// Watermark takes an input byte array, overlay byte array and opacity value | ||
// and returns the watermarked image bytes or error | ||
Watermark(base []byte, overlay []byte, opacity uint8) ([]byte, error) | ||
// GrayScale takes an input byte array and returns the grayscaled byte array or error | ||
GrayScale(input []byte) ([]byte, error) | ||
// Decode takes a byte array and returns the image, extension, and error | ||
Decode(data []byte) (image.Image, string, error) | ||
// Encode takes an image and extension and return the encoded byte array or error | ||
Encode(img image.Image, format string) ([]byte, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters