Skip to content

🔍 📷 Generate source code from an image of a code snippet/pseudocode using steganography

Notifications You must be signed in to change notification settings

adamnieto/codeography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📷 codeography


A CLI that creates code snippet images using carbon-now-cli (here), however, it can also encapsulate and generate the source code these code snippets represent pictorially via steganography.

To understand a little bit better here is a diagram to explain:

alt text

What is Steganography?

Steganography is the process of representing information within another message or physical/virtual object in such a way that is not evident in plain sight or after human inspection.

In other words, steganography is a way for us to hide messages within everyday files or objects.

Inspiration and Use Case

  • The inspiration for this project comes out of the need for providing customizable syntax highlighting to code snippets through an image without losing the ability to copy and paste the source code the code-snippet image represents pictorially. Intrinsically, this tool does the copying and pasting for you by simply generating the file from the code-snippet image you already have.

  • For instance, this tool can be used to encode a source file of a program but display pictorially the pseudocode of that program.

  • This CLI is useful for presentations that may contain code snippets, allowing the presenter to avoid styling the code manually for a slide but also not burden viewers in having to download a separate file, or copy/paste (formatting may screw up) the code snippet.


Installation:

Installing using Dev Container (recommended)

Pre-requisites: Please make sure that you have Docker installed on your machine and you are using Visual Studio Code.

  1. Download this repo:
git clone https://github.com/adamnieto/codeography.git
  1. Wait for the dev container to finish running including the postCreateCommand once that has finished it should have installed the codeography command and you can start using it.

Installing Manually

  1. Make sure that you have already installed the carbon-now-cli. Follow the installation rules here.

  2. Install Rust

  3. Download this repo:

git clone https://github.com/adamnieto/codeography.git
  1. Once inside of the codeography directory run the following command:
cargo install --path .

Usage:

Creating a code snippet image

To create a code snippet image all you need to execute is the following command:

codeography imagify <INPUT_CODE_FILE>

Example:

In this example, codeography will delegate to the carbon-now-cli in interactive mode.

codeography imagify code_snippet.rs

asciicast

Encoding a code-snippet image to steganographic code-snippet image

codeography encode <INPUT_CODE_FILE> <INPUT_IMAGE_TO_ENCODE> <ENCODE_OUTPUT_IMAGE_FILE_NAME>

Example:

In this example the CLI will create codeography_code_snippet.png.

codeography encode code_snippet.rs code_snippet.png codeography_code_snippet

asciicast

Decoding a steganographic code-snippet image to its original source code file

codeography decode <INPUT_IMAGE_TO_DECODE> <DECODE_OUTPUT_FILE_NAME>

Example:

In this example the program will create code_snippet.rs.

codeography decode codeography_code_snippet.png code_snippet

asciicast


Notes

This project is still in its early stages. If you find any bugs please report them in the issues tab.

About

🔍 📷 Generate source code from an image of a code snippet/pseudocode using steganography

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages