Skip to content

Commit

Permalink
Add PCX format support
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecot committed Nov 16, 2023
1 parent d256810 commit e1f37cd
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- Improve ZIP reader performance and precision when using `reader-zip` feature
- Reduce PDF reader memory usage and increase accuracy when using `reader-pdf` feature

## New formats support

- Picture Exchange (PCX)

# Version 0.22.0 (2023-11-04)

## Internal changes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ file-format = "0.23"
- OpenEXR (EXR)
- OpenRaster (ORA)
- Panasonic Raw (RW2)
- Picture Exchange (PCX)
- Portable Arbitrary Map (PAM)
- Portable BitMap (PBM)
- Portable FloatMap (PFM)
Expand Down
Binary file added fixtures/image/sample.pcx
Binary file not shown.
7 changes: 7 additions & 0 deletions src/formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,13 @@ formats! {
extension = "asc"
kind = Application

format = PictureExchange
name = "Picture Exchange"
short_name = "PCX"
media_type = "image/x-pcx"
extension = "pcx"
kind = Image

format = PlainText
name = "Plain Text"
short_name = "TXT"
Expand Down
12 changes: 12 additions & 0 deletions src/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,18 @@ signatures! {
format = PersonalStorageTable
value = b"!BDN"

format = PictureExchange
value = b"\x0A\x00\x00", b"\x00" offset = 64
value = b"\x0A\x00\x01", b"\x00" offset = 64
value = b"\x0A\x02\x00", b"\x00" offset = 64
value = b"\x0A\x02\x01", b"\x00" offset = 64
value = b"\x0A\x03\x00", b"\x00" offset = 64
value = b"\x0A\x03\x01", b"\x00" offset = 64
value = b"\x0A\x04\x00", b"\x00" offset = 64
value = b"\x0A\x04\x01", b"\x00" offset = 64
value = b"\x0A\x05\x00", b"\x00" offset = 64
value = b"\x0A\x05\x01", b"\x00" offset = 64

format = QemuCopyOnWrite
value = b"QFI\xFB"

Expand Down
6 changes: 6 additions & 0 deletions tests/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ fn test_panasonic_raw() {
assert_eq!(fmt, FileFormat::PanasonicRaw);
}

#[test]
fn test_picture_exchange() {
let fmt = FileFormat::from_file("fixtures/image/sample.pcx").unwrap();
assert_eq!(fmt, FileFormat::PictureExchange);
}

#[test]
fn test_portable_arbitrary_map() {
let fmt = FileFormat::from_file("fixtures/image/sample.pam").unwrap();
Expand Down

0 comments on commit e1f37cd

Please sign in to comment.