1
0

variable number of images to blend (shitcode)

This commit is contained in:
2022-05-01 20:52:03 +02:00
parent a0fbe438d4
commit e5e527298e
4 changed files with 43 additions and 19 deletions

17
main.go
View File

@ -2,7 +2,6 @@ package main
import (
"flag"
"image"
_ "image/jpeg"
_ "image/png"
)
@ -13,27 +12,17 @@ func main() {
flag.StringVar(&ConfigRegister.OutputDir, "output", "./", "Output directory")
flag.StringVar(&ConfigRegister.InputDir, "input", "/home/gator/Photos", "Input directory. Where to look the images from")
flag.StringVar(&ConfigRegister.BaseImage, "base-img", "", "Path to the base image to work with. Random image if not set")
flag.StringVar(&ConfigRegister.Dimensions, "dimensions", "800x600", "Out image dimensions. <width>x<height>")
flag.StringVar(&ConfigRegister.Dimensions, "dimensions", "1280x1024", "Out image dimensions. <width>x<height>")
flag.BoolVar(&ConfigRegister.Grayscale, "grayscale", false, "Output image in shade of gray (around 50)")
flag.IntVar(&ConfigRegister.Amount, "amount", 2, "Number of images to blend together")
flag.Parse()
// set output's width and height
ConfigRegister.SetOutputDimensions()
// get two random images and load them
var img1 image.Image
if ConfigRegister.BaseImage != "" {
img1 = loadImage(ConfigRegister.BaseImage)
} else {
img1 = loadImage(getRandomImage())
}
img2 := loadImage(getRandomImage())
// pool of workers unionizing, ready to blend a new picture using the power of friendship
var pool blendWorkerPool
pool.InitWorkerPool()
// main blending routine
pool.BlendImages(img1, img2)
pool.BlendImagesMain()
}