Skip to content

Commit

Permalink
Clenup Encode return to one place, removes print
Browse files Browse the repository at this point in the history
  • Loading branch information
auyer committed Nov 23, 2022
1 parent 8e39652 commit 8ee90fb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions steganography.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package steganography
import (
"bytes"
"errors"
"fmt"
"image"
"image/color"
"image/draw"
Expand Down Expand Up @@ -54,27 +53,25 @@ 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)

/* GREEN */
bit, ok = <-ch
if !ok {
rgbImage.SetNRGBA(x, y, c)
png.Encode(writeBuffer, rgbImage)
return nil
break
}
setLSB(&c.G, bit)

/* BLUE */
bit, ok = <-ch
if !ok {
rgbImage.SetNRGBA(x, y, c)
png.Encode(writeBuffer, rgbImage)
return nil
break
}
setLSB(&c.B, bit)

Expand All @@ -83,7 +80,6 @@ func EncodeNRGBA(writeBuffer *bytes.Buffer, rgbImage *image.NRGBA, message []byt
}

err := png.Encode(writeBuffer, rgbImage)
fmt.Println("err")
return err
}

Expand Down

0 comments on commit 8ee90fb

Please sign in to comment.