2020-09-17 19:34:22 +00:00
|
|
|
package main
|
|
|
|
|
2020-09-18 15:19:43 +00:00
|
|
|
import (
|
|
|
|
"github.com/status-im/image_resizer/files"
|
|
|
|
"github.com/status-im/image_resizer/images"
|
|
|
|
)
|
|
|
|
|
2020-09-17 19:34:22 +00:00
|
|
|
var (
|
2020-09-18 15:19:43 +00:00
|
|
|
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() {
|
2020-09-18 15:19:43 +00:00
|
|
|
imgDs := make(map[string][]images.Details)
|
2020-09-18 13:27:28 +00:00
|
|
|
|
2020-09-18 15:19:43 +00:00
|
|
|
for _, imageName := range imageList {
|
|
|
|
img := files.GetImage(images.GetSourceName(imageName))
|
|
|
|
croppedImg := images.Crop(img)
|
2020-09-17 20:53:50 +00:00
|
|
|
|
2020-09-18 13:27:28 +00:00
|
|
|
for _, size := range sizes {
|
|
|
|
for i := 1; i < 11; i++ {
|
2020-09-17 19:34:22 +00:00
|
|
|
|
2020-09-18 15:19:43 +00:00
|
|
|
ri := images.ResizeSquare(size, croppedImg)
|
|
|
|
id := images.MakeDetails(imageName, size, i*10, "")
|
|
|
|
files.RenderImage(ri, &id)
|
2020-09-18 13:27:28 +00:00
|
|
|
imgDs[imageName] = append(imgDs[imageName], id)
|
|
|
|
|
2020-09-18 15:19:43 +00:00
|
|
|
precci := images.CropCircle(ri, int(size))
|
|
|
|
precid := images.MakeDetails(imageName, size, i*10, "pre-render circle crop")
|
|
|
|
files.RenderImage(precci, &precid)
|
2020-09-18 13:27:28 +00:00
|
|
|
imgDs[imageName] = append(imgDs[imageName], precid)
|
|
|
|
|
2020-09-18 15:19:43 +00:00
|
|
|
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)
|
2020-09-18 13:27:28 +00:00
|
|
|
imgDs[imageName] = append(imgDs[imageName], postcid)
|
|
|
|
}
|
2020-09-17 19:34:22 +00:00
|
|
|
}
|
2020-09-18 13:27:28 +00:00
|
|
|
}
|
2020-09-17 19:34:22 +00:00
|
|
|
|
2020-09-18 15:19:43 +00:00
|
|
|
files.MakeReadMe(imageList, imgDs)
|
2020-09-18 13:27:28 +00:00
|
|
|
}
|