logging each steps

This commit is contained in:
Ali Gator 2022-05-01 09:07:46 +02:00
parent 09b64a7fad
commit b7053c68aa
4 changed files with 14 additions and 8 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.jpg
*.png

View File

@ -5,6 +5,7 @@ import (
"image"
"image/color"
"image/jpeg"
"log"
"math"
"os"
"runtime"
@ -82,6 +83,8 @@ func (p *blendWorkerPool) SetImageWorker(newImage *image.RGBA) {
}
func (p *blendWorkerPool) BlendImages(img1 image.Image, img2 image.Image) {
log.Println("Blending the images...")
dimensions := getDimensions(img1, img2)
// output image, ready to receive pixel values
outImg := image.NewRGBA(dimensions)
@ -103,9 +106,9 @@ func encodeImage(imgData *image.RGBA) {
outputFile := fmt.Sprintf("%s/%s", ConfigRegister.OutputDir, "output.jpg")
out, _ := os.Create(outputFile)
defer out.Close()
fmt.Print("Encoding the image...")
log.Println("Encoding the new image...")
jpeg.Encode(out, imgData, nil)
fmt.Println(" Done.")
log.Println("Done.")
}
// convert RGBA pixel to grayscale

3
fs.go
View File

@ -23,13 +23,14 @@ func loadImage(filename string) image.Image {
log.Fatal(err)
}
log.Println("Loading :", filename)
return imgData
}
// Walk through a folder recursively and returns a list of image paths
func getImagesList(path string) []string {
var imgs []string
err := filepath.Walk(path,
func(path string, info os.FileInfo, err error) error {
ext := strings.ToLower(filepath.Ext(path))