Skip to content

Commit

Permalink
docs(readme): improve text and markup; rm badge
Browse files Browse the repository at this point in the history
  • Loading branch information
dbohdan committed May 25, 2024
1 parent f12376d commit 37398ae
Showing 1 changed file with 60 additions and 52 deletions.
112 changes: 60 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
# s2png — “stuff to PNG”

[![GitHub Actions CI status.](https://github.com/dbohdan/s2png/actions/workflows/ci.yml/badge.svg)](https://gthub.com/dbohdan/s2png/actions/workflows/ci.yml)

This program encodes arbitrary binary data in PNG images that look like noise
and decodes it back. It was originally developed by k0wax
[on SourceForge](http://sourceforge.net/projects/s2png/). I started this fork
to fix a problem that caused s2png 0.01 to segfault when compiled on a modern
operating system. The fork has since accumulated various bug fixes and
improvements. Most recently, I have ported it to Rust. Among other things,
this makes it easier to distribute s2png as a static binary. The fork remains
data-compatible with the original if you don't use the toy encryption feature.
This program converts arbitrary binary data to and from PNG images that look like noise.
It was originally developed by k0wax
[on SourceForge](http://sourceforge.net/projects/s2png/).
I started this fork to fix a problem that caused s2png 0.01 to segfault
when compiled on a 2010s operating system.
The fork has since accumulated various bug fixes and improvements.
Most recently, I have ported it from C to Rust.
Among other things, this makes it easier to distribute s2png as a static binary.
The fork remains data-compatible with the original
if you don't use the toy encryption feature.


## Installation

Prebuilt binaries are available for x86\_64 Linux and i686 Windows. They are
attached to releases on the
[Releases](https://github.com/dbohdan/s2png/releases) page. Development
(unstable) binaries are also
[automatically built](https://ci.appveyor.com/project/dbohdan/s2png/build/artifacts)
for Windows.
Prebuilt binaries are available for x86-64 Linux and i686 Windows.
They are attached to releases on the
["Releases"](https://github.com/dbohdan/s2png/releases) page.

### Installing with Cargo

```shell
```sh
cargo install s2png
```

### Building on Debian and Ubuntu

Follow the instructions to build a static Linux binary of s2png from source
on recent Debian and Ubuntu.
Follow the instructions to build a static Linux binary of s2png from the source code on recent Debian and Ubuntu.

1\. Install [Rustup](https://rustup.rs/). Through Rustup, add the stable musl
libc target for your CPU.
1\. Install [Rustup](https://rustup.rs/).
Through Rustup, add the stable musl libc target for your CPU.

```sh
rustup target add x86_64-unknown-linux-musl
Expand All @@ -46,20 +42,22 @@ sudo apt install build-essential musl-tools
cargo install just
```

3\. Clone this repository. Build the binary.
3\. Clone this repository.
Build the binary.

git clone https://github.com/dbohdan/s2png
cd s2png
just test
just release-linux
```sh
git clone https://github.com/dbohdan/s2png
cd s2png
just test
just release-linux
```

### Cross-compiling for Windows

Follow the instructions to build a 32-bit Intel Windows binary of s2png on
recent Debian and Ubuntu.
Follow the instructions to build a 32-bit Intel Windows binary of s2png on recent Debian and Ubuntu.

1\. Install [Rustup](https://rustup.rs/). Through Rustup add the i686 GNU ABI
Windows target.
1\. Install [Rustup](https://rustup.rs/).
Through Rustup, add the i686 GNU ABI Windows target.

```sh
rustup target add i686-pc-windows-gnu
Expand All @@ -72,20 +70,22 @@ sudo apt install build-essential mingw-w64
cargo install just
```

3\. Configure Cargo for cross-compilation. Add the following in
`~/.cargo/config`.
3\. Configure Cargo for cross-compilation.
Add the following in `~/.cargo/config`.

```toml
[target.i686-pc-windows-gnu]
linker = "/usr/bin/i686-w64-mingw32-gcc"
```

4\. Clone this repository. Build the binary.

git clone https://github.com/dbohdan/s2png
cd s2png
just release-windows
4\. Clone this repository.
Build the binary.

```sh
git clone https://github.com/dbohdan/s2png
cd s2png
just release-windows
```

## Usage

Expand Down Expand Up @@ -117,31 +117,39 @@ See README.md for further details.

## Examples

To store `foo.mp3` in an image enter the following command:
To store `foo.mp3` in an image, enter the following command:

s2png foo.mp3
```sh
s2png foo.mp3
```

A file named `foo.mp3.png` will be created in the same directory as `foo.mp3`.

Add the `-s` switch to ensure the resulting image is square (give or take a
pixel) and `-b "some text"` to change the text of the banner at the bottom.
Add the `-s` switch to make the resulting image square (give or take a pixel)
and `-b "some text"` to change the text of the banner at the bottom.

s2png -s -b hello foo.mp3
```sh
s2png -s -b hello foo.mp3
```

To decode `decode_me.mp3.png` and retrieve the original file `decode_me.mp3` run
the command
To decode `decode_me.mp3.png` and retrieve the original file `decode_me.mp3`,
run the command

s2png decode_me.mp3.png
```sh
s2png decode_me.mp3.png
```

Decode `xyz.png` to `decoded.mp3` with

s2png -o decoded.mp3 xyz.png

```sh
s2png -o decoded.mp3 xyz.png
```

## License

s2png is licensed under the GNU GPL 2.0. See the file `LICENSE`. The
implementation of the RC4 streaming cypher in [`src/rc4/mod.rs`](src/rc4/mod.rs)
is in the public domain. The font from [libgd](https://github.com/libgd/libgd)
is distributed under its BSD-like license. See the file
[`src/font/COPYING.libgd`](src/font/COPYING.libgd).
s2png is distributed under the GNU GPL 2.0.
See the file [`LICENSE`](LICENSE).
The implementation of the RC4 streaming cypher in [`src/rc4/mod.rs`](src/rc4/mod.rs)
is in the public domain.
The font from [libgd](https://github.com/libgd/libgd) is distributed under its BSD-like license.
See the file [`src/font/COPYING.libgd`](src/font/COPYING.libgd).

0 comments on commit 37398ae

Please sign in to comment.