Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions src/ifd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ impl ImageFileDirectory {
let (tag_name, tag_value) = read_tag(cursor, bigtiff).await?;
tags.insert(tag_name, tag_value);
}
dbg!(&tags);

// Tag 2 bytes
// Type 2 bytes
Expand Down Expand Up @@ -283,7 +282,6 @@ impl ImageFileDirectory {
let mut other_tags = HashMap::new();

tag_data.drain().try_for_each(|(tag, value)| {
dbg!(&tag);
match tag {
Tag::NewSubfileType => new_subfile_type = Some(value.into_u32()?),
Tag::ImageWidth => image_width = Some(value.into_u32()?),
Expand All @@ -297,17 +295,11 @@ impl ImageFileDirectory {
PhotometricInterpretation::from_u16(value.into_u16()?)
}
Tag::ImageDescription => image_description = Some(value.into_string()?),
Tag::StripOffsets => {
dbg!(&value);
strip_offsets = Some(value.into_u64_vec()?)
}
Tag::StripOffsets => strip_offsets = Some(value.into_u64_vec()?),
Tag::Orientation => orientation = Some(value.into_u16()?),
Tag::SamplesPerPixel => samples_per_pixel = Some(value.into_u16()?),
Tag::RowsPerStrip => rows_per_strip = Some(value.into_u32()?),
Tag::StripByteCounts => {
dbg!(&value);
strip_byte_counts = Some(value.into_u64_vec()?)
}
Tag::StripByteCounts => strip_byte_counts = Some(value.into_u64_vec()?),
Tag::MinSampleValue => min_sample_value = Some(value.into_u16_vec()?),
Tag::MaxSampleValue => max_sample_value = Some(value.into_u16_vec()?),
Tag::XResolution => match value {
Expand Down Expand Up @@ -447,9 +439,6 @@ impl ImageFileDirectory {
// https://web.archive.org/web/20240329145253/https://www.awaresystems.be/imaging/tiff/tifftags/planarconfiguration.html
PlanarConfiguration::Chunky
} else {
dbg!(planar_configuration);
dbg!(samples_per_pixel);
println!("planar_configuration not found and samples_per_pixel not 1");
PlanarConfiguration::Chunky
};
Ok(Self {
Expand Down Expand Up @@ -853,7 +842,6 @@ async fn read_tag(cursor: &mut AsyncCursor, bigtiff: bool) -> AsyncTiffResult<(T
let tag_type = Type::from_u16(tag_type_code).expect(
"Unknown tag type {tag_type_code}. TODO: we should skip entries with unknown tag types.",
);
dbg!(tag_name, tag_type);
let count = if bigtiff {
cursor.read_u64().await?
} else {
Expand Down Expand Up @@ -902,7 +890,6 @@ async fn read_tag_value(
// Case 2: there is one value.
if count == 1 {
// 2a: the value is 5-8 bytes and we're in BigTiff mode.
dbg!("case 2a");
if bigtiff && value_byte_length > 4 && value_byte_length <= 8 {
let mut data = cursor.read(value_byte_length).await?;

Expand Down Expand Up @@ -932,7 +919,6 @@ async fn read_tag_value(
let mut data = cursor.read(value_byte_length).await?;

// 2b: the value is at most 4 bytes or doesn't fit in the offset field.
dbg!("case 2b");
return Ok(match tag_type {
Type::BYTE | Type::UNDEFINED => Value::Byte(data.read_u8()?),
Type::SBYTE => Value::Signed(data.read_i8()? as i32),
Expand Down Expand Up @@ -989,7 +975,6 @@ async fn read_tag_value(

// Case 3: There is more than one value, but it fits in the offset field.
if value_byte_length <= 4 || bigtiff && value_byte_length <= 8 {
dbg!("case 3");
let mut data = cursor.read(value_byte_length).await?;
if bigtiff {
cursor.advance(8 - value_byte_length);
Expand Down Expand Up @@ -1091,7 +1076,6 @@ async fn read_tag_value(
cursor.seek(offset);

// Case 4: there is more than one value, and it doesn't fit in the offset field.
dbg!("case 4");
match tag_type {
// TODO check if this could give wrong results
// at a different endianess of file/computer.
Expand Down