1
0

cleaning main + quiet mode

This commit is contained in:
2022-05-01 21:30:35 +02:00
parent e5e527298e
commit 8d79ea8200
2 changed files with 27 additions and 13 deletions

View File

@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"strconv"
@ -18,6 +19,7 @@ type Config struct {
OutputHeight int `json:output_height`
Grayscale bool
Amount int
Quiet bool
}
// loads configuration values from json file
@ -43,5 +45,21 @@ func (c *Config) SetOutputDimensions() {
c.OutputHeight = height
}
func initConfigRegister() {
// command line arguments
flag.StringVar(&ConfigRegister.Method, "blending", "darken", "Blending methods : darken, lighten, fuckyfun")
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", "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.BoolVar(&ConfigRegister.Quiet, "quiet", false, "No progress messages")
flag.Parse()
// set output's width and height
ConfigRegister.SetOutputDimensions()
}
// global register to acccess configuration values
var ConfigRegister Config