pngtext 0.3.0

Hides data inside png images

To use this package, run the following command in your project's root directory:


A steganography tool to store text or other data inside PNG images.

Getting Started

Follow these instructions to build pngtext. These instructions guide on how to build pngtext as a program, but it can also be used as a library.


You need to have these installed on you machine to build pngtext:

  1. the dub package manager
  2. a dlang compiler. dmd works
  3. an internet connection for dub to fetch the dependencies


Run these commands to build pngtext:

dub fetch pngtext
dub build pngtext -c=pngtextapp -b=release

If the build is succesful, the built binary will be in ~/.dub/packages/pngtext-*/pngtext/ Copy the binary to a path where the shell can find it (could be ~/.local/bin/).

Running Tests

To run the unittests on pngtext run: dub test pngtext


This describes how to use pngtext.

Writing Data to PNG Image

Text Editor

pngtext comes with a built in simple terminal based text editor. To edit hidden text in a png image, run this: pngtext path/to/pngImage.png or: pngtext editor -i path/to/pngImage.png


Aside from text editor, you can also write other types of data using write command:

The following command will read data from stdin and encode it in pngFile.png, and write resulting image to outputPngFile.png: pngtext write -i pngFile.png -o outputPngFile.png

To read the data from a file, use the --file or -f option: pngtext write -i pngFile.png -o outputPngFile.png -f fileContainingData

Reading Data from PNG Image

To read data, that was written using pngtext, use the read command: pngtext read -i pngFile.png

To read the stored data into a file, use the --output or -o option to specify the output file: pngtext read -i pngFile.png -o outputDataFile

Calculating Maximum Data Capacity from PNG Image

To calculate exactly how many bytes a png image will be able to store, use the size command: pngtext size -i pngFile.png [-q QUALITY] This will write the number of bytes pngFile.png can hold if all pixels are used. Values for -q option are below:

  • 1 - highest quality - 4 bits per pixel - 12.5% loss
  • 2 - high quality - 8 bits per pixel - 25% loss
  • 3 - low quality - 16 bits per pixel - 50% loss
  • 4 - zero quality - 32 bits per pixel - 100% loss
  • Nafees Hassan
utils, qui
0.3.0 2020-Jul-09
0.2.2 2020-Jan-10
0.2.1 2020-Jan-07
0.2.0 2020-Jan-07
0.1.1 2019-Feb-04
Show all 7 versions
Download Stats:
  • 0 downloads today

  • 2 downloads this week

  • 2 downloads this month

  • 14 downloads total

Short URL: