-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thumbnail quality options #44
Comments
I can take it |
Hey @berkingurcan thanks! Sorry for the late reply, been extra busy lately. Here you'll find all of the image thumbnail generation logic. Essentially, what I was thinking was to update what's there, and add a few new functions for the new formats, to allow future custom scaling options. Something like: /// The size factor to use when generating a thumbnail. This can be a
/// scaled factor, where the height and width are scaled by the same factor, a
/// a custom factor, where the height and width are scaled by different factors,
/// or a specific size, where the height and width are set to the specified size.
///
/// All floats are clamped to the range [0.0, 1.0].
pub enum ThumbnailSizeFactor {
Scaled(f32),
CustomScaled((f32, f32)),
Sized((u32, u32)),
}
/// The format to use when generating a thumbnail.
pub enum ThumbnailFormat {
Webp,
Jpeg,
JpegXl,
Png,
}
pub struct ThumbnailConfig {
pub size_factor: ThumbnailSizeFactor,
pub format: ThumbnailFormat,
}
impl Default for ThumbnailConfig {
fn default() -> Self {
Self {
size_factor: ThumbnailSizeFactor::Scaled(0.5),
format: ThumbnailFormat::Webp,
}
}
} So the thumbnail functions would take a reference to a
But, I'll leave that up to you. I think for now you can leave the jpeg-xl format alone, since it would require pulling in https://github.com/inflation/jpegxl-rs, but if you want to try it feel free. |
Resolved from #134 |
I'd like to add additional configuration options around thumbnail generation. Primarily, I'd like to support the following:
I will need to decide whether this should be library or server level options.
General tasks:
image
crate that handles the conversionThe text was updated successfully, but these errors were encountered: