update smartcrop2 to v0.4.0, remove black borders from album covers

This commit is contained in:
ThetaDev 2025-03-04 22:38:01 +01:00
parent 965d76472b
commit fb76c85472
2 changed files with 8 additions and 4 deletions

View file

@ -51,7 +51,7 @@ image = { version = "0.25.0", optional = true, default-features = false, feature
"jpeg", "jpeg",
"webp", "webp",
] } ] }
smartcrop2 = { version = "0.3.1", optional = true } smartcrop2 = { version = "0.4.0", optional = true }
[dev-dependencies] [dev-dependencies]
path_macro.workspace = true path_macro.workspace = true

View file

@ -1033,7 +1033,11 @@ impl DownloadQuery {
image::load_from_memory(&img_bts)? image::load_from_memory(&img_bts)?
}; };
let crop = smartcrop::find_best_crop(&img, NonZeroU32::MIN, NonZeroU32::MIN) let crop = smartcrop::find_best_crop_no_borders(
&img,
NonZeroU32::MIN,
NonZeroU32::MIN,
)
.map_err(|e| DownloadError::AudioTag(format!("image crop: {e}").into()))? .map_err(|e| DownloadError::AudioTag(format!("image crop: {e}").into()))?
.crop; .crop;
img = img.crop_imm(crop.x, crop.y, crop.width, crop.height); img = img.crop_imm(crop.x, crop.y, crop.width, crop.height);