2018-06-09 04:25:16 +00:00
|
|
|
package thumbnail
|
|
|
|
|
|
|
|
type OutputFormat uint8
|
|
|
|
type AspectFormat uint8
|
|
|
|
type ScaleFormat uint8
|
|
|
|
|
|
|
|
const (
|
2018-06-09 04:39:41 +00:00
|
|
|
Png OutputFormat = 1
|
|
|
|
PngCrush OutputFormat = 2
|
|
|
|
Jpeg OutputFormat = 3
|
|
|
|
Bmp OutputFormat = 4
|
2018-06-09 04:25:16 +00:00
|
|
|
|
2018-06-09 04:39:41 +00:00
|
|
|
FitOutside AspectFormat = 80 // Pad out with black bars to dimensions
|
|
|
|
FitInside AspectFormat = 82 // Crop to dimensions
|
2018-06-09 05:20:27 +00:00
|
|
|
Stretch AspectFormat = 83 // Doesn't preserve aspect ratio
|
2018-06-09 04:25:16 +00:00
|
|
|
|
2018-06-09 04:39:41 +00:00
|
|
|
NearestNeighbour ScaleFormat = 120
|
2018-06-09 05:17:57 +00:00
|
|
|
BilinearFast ScaleFormat = 121
|
|
|
|
BilinearAccurate ScaleFormat = 122
|
|
|
|
Bicubic ScaleFormat = 123
|
2018-06-09 04:25:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
Width int
|
|
|
|
Height int
|
|
|
|
Output OutputFormat
|
|
|
|
Aspect AspectFormat
|
|
|
|
Scale ScaleFormat
|
|
|
|
}
|
|
|
|
|
|
|
|
var DefaultConfig = Config{
|
|
|
|
Width: 128,
|
|
|
|
Height: 128,
|
2018-06-09 04:39:41 +00:00
|
|
|
Output: Jpeg,
|
2018-06-09 05:18:16 +00:00
|
|
|
Aspect: FitOutside,
|
|
|
|
Scale: Bicubic,
|
2018-06-09 04:25:16 +00:00
|
|
|
}
|