fcam 0.2.0

Convert binary files to images.
fcam-0.2.0 is not a library.

fCam

fCam is a fast, command-line utility for converting a raw stream of bytes into a square PNG image. It processes an input file as consecutive 8-bit RGB color channels without any header or formatting data.

Usage

fcam <input_file> <output_file> <size> [--loop-y]

Arguments

  • <input_file>: Path to the raw binary file you want to visualize.
  • <output_file>: Path where the resulting image will be saved (e.g., output.png).
  • <size>: The width and height of the generated square image in pixels.
  • [--loop-y]: (Optional) By default, fCam generates pixels in a column-major order (X-axis first). If --loop-y is specified anywhere in the arguments, it will generate pixels in a row-major order (Y-axis first).

Building

cargo build --release

Example

The accompanying example.png was generated from random data using fcam:

# Generate exactly 512 * 512 * 3 (786,432) bytes of random data
head -c 786432 </dev/urandom > random.bin

# Run fcam
fcam random.bin example.png 512

Result

Example showing fCam's output on random noise

Web Version

An interactive web version of fCam is also available in the web/ directory. It accurately replicates the behavior of the Rust CLI tool entirely in your browser using JavaScript and the HTML <canvas> API.

Usage

  1. Open web/index.html in any modern web browser.
  2. Click Choose File to upload your raw binary file.
  3. Enter the desired Image Size (width and height).
  4. Optionally toggle --loop-y for row-major pixel rendering.
  5. Click Generate Image to view the output instantly without the need for an external server.
  6. Click Download Image to save the generated PNG.