summaryrefslogtreecommitdiff
path: root/src/tiff.rs
diff options
context:
space:
mode:
authorcc <cc@localhost>2025-08-20 17:47:38 -0700
committercc <cc@localhost>2025-08-20 17:47:38 -0700
commit079dc54c945f12380b7b935a0765dba76fac257f (patch)
tree3e270c03d0943992ee153231d027099f2e8fb5e8 /src/tiff.rs
parent972a413ebf54edbdd777379f1db7ebb6731f5ecc (diff)
Read Entire TIFF data
Diffstat (limited to 'src/tiff.rs')
-rw-r--r--src/tiff.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tiff.rs b/src/tiff.rs
index 08f4d54..8e77233 100644
--- a/src/tiff.rs
+++ b/src/tiff.rs
@@ -97,3 +97,19 @@ pub fn read_strip(tiff_ptr: *mut TIFF, strip: u32) -> Vec<u8> {
}
buf
}
+
+pub fn read(tiff_ptr: *mut TIFF) -> Vec<u8> {
+ let strip_size = get_strip_size(tiff_ptr);
+ let strip_count = get_strip_count(tiff_ptr);
+ let mut total_buf: Vec<u8> = vec![0u8; (strip_size * strip_count) as usize];
+ for strip_index in 0..strip_count {
+ let sub_buffer: Vec<u8> = read_strip(tiff_ptr, strip_index as u32);
+ let base_index = strip_index * strip_size;
+ for data_index in 0..strip_size {
+ let total_index = base_index + data_index;
+ let data = sub_buffer[data_index as usize];
+ total_buf[total_index as usize] = data;
+ }
+ }
+ total_buf
+}