1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! A library for encoding arbitrary data
//! into images, a tecnique also known as *steganography*.
//!
//! This is the foundation for the `seagul` cli application.
//!
//! # Basic example
//!
//! ## Encode
//!
//! Read an image and resave it with some verses encoded into it, using the
//! last 2 bits on the blue channel of each pixel to encode them
//!
//! ```rust
//! let encode_result = super::ImageEncoder::from("source.png")
//! .set_use_n_lsb(2)
//! .set_use_channel(RgbChannel::Blue)
//! .encode_data(
//! b"
//! Midway upon the journey of our life
//! I found myself within a forest dark,
//! For the straightforward pathway had been lost.
//! Ah me! how hard a thing it is to say
//! What was this forest savage, rough, and stern,
//! Which in the very thought renews the fear.
//! So bitter is it, death is little more;
//! But of the good to treat, which there I found,
//! Speak will I of the other things I saw there.
//! I cannot well repeat how there I entered,
//! So full was I of slumber at the moment
//! In which I had abandoned the true way.",
//! );
//!
//! assert!(encode_result.is_ok(), "Encoding failed");
//!
//! encode_result
//! .unwrap()
//! .save("encoded.png", ImageFormat::Png)
//! .expect("Could not create output file");
//! ```
//!
//! ## Decode
//!
//! ```rust
//! let decoded = ImageDecoder::from("encoded.png")
//! .set_use_n_lsb(2)
//! .set_use_channel(RgbChannel::Blue)
//! .until_marker(Some(b"way.")) // <- If you know how the message ends
//! .decode();
//!
//! assert!(decoded.is_ok());
//!
//! let decoded = decoded.unwrap().as_raw();
//!
//! println!("Raw decoded:\n{}", decoded_string);
//!
//! ```
//!
//! # Supported formats
//!
//! While almost every major image format is supported as input, at the moment only
//! PNG and BMP are supported as output formats. JPEG and other formats support is planned.
/// The module holding all the base components and traits for the library
/// The module holding all the encoders
/// The module holding all the decoders