docs: Documentation and minor changes
This commit is contained in:
39
README.md
Normal file
39
README.md
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Papulastic image format
|
||||||
|
|
||||||
|
Simple image format encoded/decoder and metadata extractor from file format from some random documentation from school.
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
|
||||||
|
Just compile the binary 💀
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if you wanna be menace to society you can run `cargo run` everytime.
|
||||||
|
|
||||||
|
## Encoding
|
||||||
|
|
||||||
|
```bash
|
||||||
|
papulastic-image-format encode --input INPUT -o OUTPUT
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also include initials and custom signature
|
||||||
|
|
||||||
|
```bash
|
||||||
|
papulastic-image-format encode -i INPUT -o OUTPUT --initials JK --signature FALSE-BLINDNESS
|
||||||
|
```
|
||||||
|
|
||||||
|
## Decoding
|
||||||
|
|
||||||
|
```bash
|
||||||
|
papulastic-image-format decode -i INPUT -o OUTPUT.png
|
||||||
|
```
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
|
||||||
|
```bash
|
||||||
|
papulastic-image-format metadata -i INPUT
|
||||||
|
```
|
||||||
|
|
||||||
|
This code is not perfect but the documentation isn't too so I can't be bothered.
|
||||||
@ -21,7 +21,7 @@ pub enum Commands {
|
|||||||
#[arg(short='a', long, default_value = "UN")]
|
#[arg(short='a', long, default_value = "UN")]
|
||||||
initials: String,
|
initials: String,
|
||||||
|
|
||||||
#[arg(short='a', long, default_value = "TRUEVISION-XFILE")]
|
#[arg(short='s', long, default_value = "TRUEVISION-XFILE")]
|
||||||
signature: String,
|
signature: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -7,8 +7,8 @@ use std::io::{BufWriter, Write};
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn encode(input: &Path, output: &Path, initials: &str, signature: &str, origin: u8) -> Result<()> {
|
pub fn encode(input: &Path, output: &Path, initials: &str, signature: &str, origin: u8) -> Result<()> {
|
||||||
if signature.len() > 15 {
|
if signature.len() > 16 {
|
||||||
return Err(GfxError::Format("Signature longer than 15 bytes!".into()));
|
return Err(GfxError::Format("Signature longer than 16 bytes!".into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let img = image::open(input)?;
|
let img = image::open(input)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user