From 8ee90fbc59d29770b43f2042f945c41ce5cc1dca Mon Sep 17 00:00:00 2001 From: Auyer Date: Tue, 22 Nov 2022 23:15:07 -0300 Subject: [PATCH] Clenup Encode return to one place, removes print --- steganography.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/steganography.go b/steganography.go index d8368d4..7295869 100644 --- a/steganography.go +++ b/steganography.go @@ -4,7 +4,6 @@ package steganography import ( "bytes" "errors" - "fmt" "image" "image/color" "image/draw" @@ -54,9 +53,9 @@ func EncodeNRGBA(writeBuffer *bytes.Buffer, rgbImage *image.NRGBA, message []byt /* RED */ bit, ok = <-ch if !ok { // if we don't have any more bits left in our message + rgbImage.SetNRGBA(x, y, c) - png.Encode(writeBuffer, rgbImage) - // return *writeBuffer, nil + break } setLSB(&c.R, bit) @@ -64,8 +63,7 @@ func EncodeNRGBA(writeBuffer *bytes.Buffer, rgbImage *image.NRGBA, message []byt bit, ok = <-ch if !ok { rgbImage.SetNRGBA(x, y, c) - png.Encode(writeBuffer, rgbImage) - return nil + break } setLSB(&c.G, bit) @@ -73,8 +71,7 @@ func EncodeNRGBA(writeBuffer *bytes.Buffer, rgbImage *image.NRGBA, message []byt bit, ok = <-ch if !ok { rgbImage.SetNRGBA(x, y, c) - png.Encode(writeBuffer, rgbImage) - return nil + break } setLSB(&c.B, bit) @@ -83,7 +80,6 @@ func EncodeNRGBA(writeBuffer *bytes.Buffer, rgbImage *image.NRGBA, message []byt } err := png.Encode(writeBuffer, rgbImage) - fmt.Println("err") return err }