logging each steps
This commit is contained in:
15
blend.go
15
blend.go
@ -5,6 +5,7 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
"image/jpeg"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"runtime"
|
||||
@ -13,10 +14,10 @@ import (
|
||||
|
||||
// job passed to goroutines. blend color from img1 and img2 at position (x, y)
|
||||
type blendColorJob struct {
|
||||
X int
|
||||
Y int
|
||||
Img1 image.Image
|
||||
Img2 image.Image
|
||||
X int
|
||||
Y int
|
||||
Img1 image.Image
|
||||
Img2 image.Image
|
||||
}
|
||||
|
||||
// new color after blend, to apply at position (x, y)
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user