Skip to content
Snippets Groups Projects
Commit e1f97e91 authored by Stephen D's avatar Stephen D
Browse files

even better image resizing logic

parent 367cc9e1
No related branches found
No related tags found
No related merge requests found
...@@ -22,11 +22,15 @@ impl ImgInfo { ...@@ -22,11 +22,15 @@ impl ImgInfo {
// resize so that the larger dimension is 512 // resize so that the larger dimension is 512
let (mut w, mut h) = resize_dimensions(img.width(), img.height(), IMG_DIM, IMG_DIM, false); let (mut w, mut h) = resize_dimensions(img.width(), img.height(), IMG_DIM, IMG_DIM, false);
let img = img.resize_exact(w, h, FilterType::Triangle);
// make both dimensions divisible by 16 (SSDV requirement) // make both dimensions divisible by 16 (SSDV requirement)
w -= w % 16; let wdiff = w % 16;
h -= h % 16; let hdiff = h % 16;
w -= wdiff;
h -= hdiff;
let img = img.resize_exact(w, h, FilterType::Triangle); let img = img.crop_imm(wdiff / 2, hdiff / 2, w, h);
let mut bytes = vec![]; let mut bytes = vec![];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment