-
Notifications
You must be signed in to change notification settings - Fork 4
/
transform.go
54 lines (48 loc) · 1.07 KB
/
transform.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package mahi
import (
"context"
"time"
)
type TransformService interface {
Transform(ctx context.Context, f *File, blob *FileBlob, opts TransformationOption) (*FileBlob, error)
}
type TransformStorage interface {
Store(ctx context.Context, n *NewTransformation) (*Transformation, error)
}
type Transformation struct {
ID string
ApplicationID string
FileID string
Actions TransformationOption
CreatedAt time.Time
UpdatedAt time.Time
}
type NewTransformation struct {
ApplicationID string
FileID string
Actions TransformationOption
}
type TransformationOption struct {
// Width
Width int
// Height
Height int
// Format
Format string
// Quality the quality of the JPEG image defaults to 80.
Quality int
// Compression compression for a PNG image defaults to 6.
Compression int
// Crop uses lib vips smart crop to crop image
Crop bool
// Rotate image rotation angle. Must be a multiple of 90
Rotate int
// Flip flips an image
Flip bool
// Flop flops an image
Flop bool
// Zoom
Zoom int
// black and white
BW bool
}