rotate image pixels, prototype a function to get exif data

This commit is contained in:
B. Petersen
2020-06-15 00:33:50 +02:00
parent 7362941245
commit 9307f2d49f

View File

@@ -14,6 +14,7 @@ use thiserror::Error;
use crate::config::Config;
use crate::constants::*;
use crate::context::Context;
use crate::error::Error;
use crate::events::Event;
use crate::message;
@@ -408,7 +409,13 @@ impl<'a> BlobObject<'a> {
return Ok(());
}
let img = img.thumbnail(img_wh, img_wh);
let mut img = img.thumbnail(img_wh, img_wh);
match self.get_exif_orientation() {
Ok(90) => img = img.rotate90(),
Ok(180) => img = img.rotate180(),
Ok(270) => img = img.rotate270(),
_ => {}
}
img.save(&blob_abs).map_err(|err| BlobError::WriteFailure {
blobdir: context.get_blobdir().to_path_buf(),
@@ -418,6 +425,10 @@ impl<'a> BlobObject<'a> {
Ok(())
}
pub fn get_exif_orientation(&self) -> Result<i32, Error> {
Ok(0)
}
}
impl<'a> fmt::Display for BlobObject<'a> {