png-steganography

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 19 Imported by: 0

README

This encoding is easily detected (data is hidden in the last few bits of every pixel's channel) - do not use for sensitive data.

  • To output help info use -h
  • To output license info use -l - this program is licensed under gpl-3-or-later

Installation

If you have golang installed

go install codeberg.org/oliverd/png-steganography@latest

This will install in GOPATH/bin

Or download the latest binaries from releases

Basic usage

# uses 2 bits per channel, example.png should be in the current directory
png-steganography -i example.png -d "hello" -o hidden.png -b 2* # Encode data to hidden.png using example.png as a base
png-steganography -i hidden.png -b 2* # Decode data in hidden.png

Channel options

# uses 3 bits from the blue channel and 2 bits from the others. Data will be stored in order Blue, Red, Green
png-steganography -i example.png -d "hello" -o hidden.png -b 3,2,2 -c BRG
png-steganography -i hidden.png -b 3,2,2 -c BRG

note * repeats the last values the required times e.g -b 2* is equivalent to -b 2,2* or even -b 2,2,2,2

Formatting

png-steganography -i example.png -d "48656C6C6F20576F726C640A00" -o hidden.png -b 2* -f hex # -d will use hexadecimal,
png-steganography -i hidden.png -b 2* -f hex # data will be output in hexadecimal
png-steganography -i hidden.png -b 2* # data will be output as a string

Options for -f (these can be used to specify the encoding of -d or the output)

  • hex: hexadecimal
  • str: string (Null terminated)
  • b64: base64
  • bin: same as string but will ignore NULL

Other options

  • -a all: decoder will read the last binary data even if it is not a whole byte (if the string mode is used Null will still be respected)
  • -p padding: how many bits should be skipped in the writable components - in encoding mode these bits will not be changed
  • -r rounding mode: t: truncate, n: nearest
  • -t type: what image type do you want to encode/decode color: C32, C64 or grey: G8, G16 or alpha: A8, A16

Faq

Output is gibberish

  • -b needs to be passed the correct number of bits for each channel
  • Check what ordering the channels use for your input image, program default is RGBA, for example you could change the alpha channel to be first by passing -c ARGB

Only partial output

If the default string mode encounters a null byte it will terminate - You can pass -f bin to prevent this behavior

Illegal base64 data

There needs to be a multiple of 4 characters in base64. Use = to pad

Building

Note: This package only depends on the Go standard library

Clone repo (you need to be your src directory GOPATH/src)

git clone https://codeberg.org/oliverd/png-steganography
cd png-steganography # need to be in directory for following commands

Run your version

go run . -i example.png -d "hello" -o hidden.png -b 2*
go run . -i hidden.png -b 2*

Build and install (command line png-steganography will now use your version)

# -w -s to strip debug symbols, panics will still be readable
go install -ldflags "-w -s" .

Compile to all targets

go install github.com/mitchellh/gox@latest # only need if you don't have gox yet
gox -output "build/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-w -s"

This documentation can be reused under GPL-3-or-later or CC-SA-4.0 - (C) Oliver Day

Documentation

Overview

Png Steganography - Command line tool for stenographic decoding and encoding of data in png files Copyright (C) 2026 Oliver Day

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL