Skip to content

Commit

Permalink
Fix write image
Browse files Browse the repository at this point in the history
  • Loading branch information
quambene committed Apr 5, 2024
1 parent e5effab commit c34ee97
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/sources/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,15 @@ pub fn write_image(
let image = df
.column(image_column)
.context("Can't find column for images")?
.list()
.binary()
.context("Can't convert series to chunked array")?
.get(i);

println!("Save query result to file: {}", target_path.display());

if let Some(image) = image {
let bytes = image
.u8()
.context("Can't convert series to chunked array")?
.into_iter()
.map(|byte| byte.expect("Can't convert series to bytes"))
.collect::<Vec<_>>();

if let Some(bytes) = image {
let mut file = File::create(target_path).context("Unable to create file")?;
file.write_all(bytes.as_slice())
.context("Unable to write file.")?;
file.write_all(bytes).context("Unable to write file.")?;
}
}

Expand Down

0 comments on commit c34ee97

Please sign in to comment.