image-resizer/main.go

58 lines
1.3 KiB
Go
Raw Permalink Normal View History

2020-09-17 19:34:22 +00:00
package main
import (
"github.com/status-im/image_resizer/files"
"github.com/status-im/image_resizer/images"
)
2020-09-17 19:34:22 +00:00
var (
imageList = []string{
2020-09-17 21:55:13 +00:00
"elephant",
"frog",
2020-09-17 19:34:22 +00:00
"goat",
2020-09-17 21:55:13 +00:00
"mars",
2020-09-17 19:34:22 +00:00
"psychedelic",
"rainbow",
"romanian-flag",
"tormund",
"woman",
}
sizes = []uint{
2020-09-18 10:23:34 +00:00
80,
240,
2020-09-17 19:34:22 +00:00
}
)
func main() {
imgDs := make(map[string][]images.Details)
for _, imageName := range imageList {
img := files.GetImage(images.GetSourceName(imageName))
croppedImg := images.Crop(img)
2020-09-17 20:53:50 +00:00
for _, size := range sizes {
for i := 1; i < 11; i++ {
2020-09-17 19:34:22 +00:00
ri := images.ResizeSquare(size, croppedImg)
id := images.MakeDetails(imageName, size, i*10, "")
files.RenderImage(ri, &id)
imgDs[imageName] = append(imgDs[imageName], id)
precci := images.CropCircle(ri, int(size))
precid := images.MakeDetails(imageName, size, i*10, "pre-render circle crop")
files.RenderImage(precci, &precid)
imgDs[imageName] = append(imgDs[imageName], precid)
li := files.GetImage(id.FileName)
postcci := images.CropCircle(li, int(size))
postcid := images.MakeDetails(imageName, size, i*10, "post-render circle crop")
files.RenderImage(postcci, &postcid)
imgDs[imageName] = append(imgDs[imageName], postcid)
}
2020-09-17 19:34:22 +00:00
}
}
2020-09-17 19:34:22 +00:00
files.MakeReadMe(imageList, imgDs)
}