logging each steps
This commit is contained in:
parent
09b64a7fad
commit
b7053c68aa
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.jpg
|
||||
*.png
|
7
blend.go
7
blend.go
@ -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
3
fs.go
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user