|
4 | 4 | //! - Image compression with resize to max 1920px |
5 | 5 | //! - GIF preservation (skip compression to keep animation) |
6 | 6 | //! - PNG for transparent images, JPEG for opaque |
7 | | -//! - Blurhash generation for previews |
| 7 | +//! - ThumbHash generation for previews |
8 | 8 |
|
9 | 9 | use std::sync::Arc; |
10 | 10 |
|
@@ -36,9 +36,9 @@ pub(super) fn compress_bytes_internal( |
36 | 36 |
|
37 | 37 | let (width, height) = (img.width(), img.height()); |
38 | 38 |
|
39 | | - let img_meta = crate::util::generate_blurhash_from_image(&img) |
40 | | - .map(|blurhash| ImageMetadata { |
41 | | - blurhash, |
| 39 | + let img_meta = crate::util::generate_thumbhash_from_image(&img) |
| 40 | + .map(|thumbhash| ImageMetadata { |
| 41 | + thumbhash, |
42 | 42 | width, |
43 | 43 | height, |
44 | 44 | }); |
@@ -71,10 +71,10 @@ pub(super) fn compress_bytes_internal( |
71 | 71 | let actual_width = resized_img.width(); |
72 | 72 | let actual_height = resized_img.height(); |
73 | 73 |
|
74 | | - // Generate metadata from final image only (avoid redundant blurhash generation) |
75 | | - let final_meta = crate::util::generate_blurhash_from_image(&resized_img) |
76 | | - .map(|blurhash| ImageMetadata { |
77 | | - blurhash, |
| 74 | + // Generate metadata from final image only (avoid redundant thumbhash generation) |
| 75 | + let final_meta = crate::util::generate_thumbhash_from_image(&resized_img) |
| 76 | + .map(|thumbhash| ImageMetadata { |
| 77 | + thumbhash, |
78 | 78 | width: actual_width, |
79 | 79 | height: actual_height, |
80 | 80 | }); |
@@ -139,17 +139,17 @@ pub(super) fn compress_image_internal(file_path: &str) -> Result<CachedCompresse |
139 | 139 | let original_size = bytes.len() as u64; |
140 | 140 |
|
141 | 141 | // For GIFs, skip compression entirely to preserve animation |
142 | | - // Just decode first frame for blurhash, then return original bytes |
| 142 | + // Just decode first frame for thumbhash, then return original bytes |
143 | 143 | if extension == "gif" { |
144 | | - // Decode just to get dimensions and generate blurhash from first frame |
| 144 | + // Decode just to get dimensions and generate thumbhash from first frame |
145 | 145 | let img = ::image::load_from_memory(&bytes) |
146 | 146 | .map_err(|e| format!("Failed to decode GIF: {}", e))?; |
147 | 147 |
|
148 | 148 | let (width, height) = (img.width(), img.height()); |
149 | 149 |
|
150 | | - let img_meta = crate::util::generate_blurhash_from_image(&img) |
151 | | - .map(|blurhash| ImageMetadata { |
152 | | - blurhash, |
| 150 | + let img_meta = crate::util::generate_thumbhash_from_image(&img) |
| 151 | + .map(|thumbhash| ImageMetadata { |
| 152 | + thumbhash, |
153 | 153 | width, |
154 | 154 | height, |
155 | 155 | }); |
@@ -183,9 +183,9 @@ pub(super) fn compress_image_internal(file_path: &str) -> Result<CachedCompresse |
183 | 183 | let actual_width = resized_img.width(); |
184 | 184 | let actual_height = resized_img.height(); |
185 | 185 |
|
186 | | - let img_meta = crate::util::generate_blurhash_from_image(&resized_img) |
187 | | - .map(|blurhash| ImageMetadata { |
188 | | - blurhash, |
| 186 | + let img_meta = crate::util::generate_thumbhash_from_image(&resized_img) |
| 187 | + .map(|thumbhash| ImageMetadata { |
| 188 | + thumbhash, |
189 | 189 | width: actual_width, |
190 | 190 | height: actual_height, |
191 | 191 | }); |
@@ -228,9 +228,9 @@ pub(super) fn compress_image_internal(file_path: &str) -> Result<CachedCompresse |
228 | 228 |
|
229 | 229 | let (width, height) = (img.width(), img.height()); |
230 | 230 |
|
231 | | - let img_meta = crate::util::generate_blurhash_from_image(&img) |
232 | | - .map(|blurhash| ImageMetadata { |
233 | | - blurhash, |
| 231 | + let img_meta = crate::util::generate_thumbhash_from_image(&img) |
| 232 | + .map(|thumbhash| ImageMetadata { |
| 233 | + thumbhash, |
234 | 234 | width, |
235 | 235 | height, |
236 | 236 | }); |
@@ -263,9 +263,9 @@ pub(super) fn compress_image_internal(file_path: &str) -> Result<CachedCompresse |
263 | 263 | let actual_width = resized_img.width(); |
264 | 264 | let actual_height = resized_img.height(); |
265 | 265 |
|
266 | | - let img_meta = crate::util::generate_blurhash_from_image(&resized_img) |
267 | | - .map(|blurhash| ImageMetadata { |
268 | | - blurhash, |
| 266 | + let img_meta = crate::util::generate_thumbhash_from_image(&resized_img) |
| 267 | + .map(|thumbhash| ImageMetadata { |
| 268 | + thumbhash, |
269 | 269 | width: actual_width, |
270 | 270 | height: actual_height, |
271 | 271 | }); |
|
0 commit comments