Skip to content

Commit 9a0496e

Browse files
committed
Otb encoding / decoding
1 parent 42a2d9a commit 9a0496e

15 files changed

+522
-12
lines changed

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ publish = false
88
include = ["src", "tests/reference.rs"]
99

1010
[features]
11-
default = ["pcx", "wbmp"]
11+
default = ["pcx", "wbmp", "otb"]
1212
pcx = []
13-
wbmp = []
13+
wbmp = ["dep:wbmp"]
14+
otb = []
1415

1516
[dependencies]
1617
image = { version = "0.25.5", default-features = false }
1718
pcx = "0.2.4"
18-
wbmp = "0.1.2"
19+
wbmp = { version = "0.1.2", optional = true }
1920

2021
[dev-dependencies]
2122
image = { version = "0.25.5", default-features = false, features = ["png"] }

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Decoding support for additional image formats beyond those provided by the [`ima
77
| --------- | -------------------- |
88
| PCX | [Wikipedia](https://en.wikipedia.org/wiki/PCX#PCX_file_format) |
99
| WBMP | [Wikipedia](https://en.wikipedia.org/wiki/Wireless_Application_Protocol_Bitmap_Format) |
10+
| OTB | [Wikipedia](https://en.wikipedia.org/wiki/OTA_bitmap) |
1011

1112
## New Formats
1213

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,23 @@ pub mod pcx;
2121
#[cfg(feature = "wbmp")]
2222
pub mod wbmp;
2323

24+
#[cfg(feature = "otb")]
25+
pub mod otb;
26+
2427
/// Register all enabled extra formats with the image crate.
2528
pub fn register() {
2629
image::hooks::register_decoding_hook(
2730
image::ImageFormat::Pcx,
2831
Box::new(|r| Ok(Box::new(pcx::PCXDecoder::new(r)?))),
2932
);
33+
#[cfg(feature = "wbmp")]
3034
image::hooks::register_decoding_hook(
3135
image::ImageFormat::Wbmp,
3236
Box::new(|r| Ok(Box::new(wbmp::WbmpDecoder::new(r)?))),
3337
);
38+
#[cfg(feature = "otb")]
39+
image::hooks::register_decoding_hook(
40+
image::ImageFormat::Otb,
41+
Box::new(|r| Ok(Box::new(otb::OtbDecoder::new(r)?))),
42+
);
3443
}

0 commit comments

Comments
 (0)