datago 2025.3.11__tar.gz → 2025.3.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {datago-2025.3.11 → datago-2025.3.12}/Cargo.lock +1 -1
  2. {datago-2025.3.11 → datago-2025.3.12}/Cargo.toml +2 -2
  3. {datago-2025.3.11 → datago-2025.3.12}/PKG-INFO +1 -1
  4. {datago-2025.3.11 → datago-2025.3.12}/src/image_processing.rs +18 -9
  5. {datago-2025.3.11 → datago-2025.3.12}/.github/workflows/ci-cd.yml +0 -0
  6. {datago-2025.3.11 → datago-2025.3.12}/.github/workflows/rust.yml +0 -0
  7. {datago-2025.3.11 → datago-2025.3.12}/.gitignore +0 -0
  8. {datago-2025.3.11 → datago-2025.3.12}/.pre-commit-config.yaml +0 -0
  9. {datago-2025.3.11 → datago-2025.3.12}/LICENSE +0 -0
  10. {datago-2025.3.11 → datago-2025.3.12}/README.md +0 -0
  11. {datago-2025.3.11 → datago-2025.3.12}/pyproject.toml +0 -0
  12. {datago-2025.3.11 → datago-2025.3.12}/python/benchmark_db.py +0 -0
  13. {datago-2025.3.11 → datago-2025.3.12}/python/benchmark_filesystem.py +0 -0
  14. {datago-2025.3.11 → datago-2025.3.12}/python/dataset.py +0 -0
  15. {datago-2025.3.11 → datago-2025.3.12}/python/raw_types.py +0 -0
  16. {datago-2025.3.11 → datago-2025.3.12}/python/test_datago_db.py +0 -0
  17. {datago-2025.3.11 → datago-2025.3.12}/python/test_datago_filesystem.py +0 -0
  18. {datago-2025.3.11 → datago-2025.3.12}/requirements-tests.txt +0 -0
  19. {datago-2025.3.11 → datago-2025.3.12}/requirements.txt +0 -0
  20. {datago-2025.3.11 → datago-2025.3.12}/src/client.rs +0 -0
  21. {datago-2025.3.11 → datago-2025.3.12}/src/generator_files.rs +0 -0
  22. {datago-2025.3.11 → datago-2025.3.12}/src/generator_http.rs +0 -0
  23. {datago-2025.3.11 → datago-2025.3.12}/src/lib.rs +0 -0
  24. {datago-2025.3.11 → datago-2025.3.12}/src/main.rs +0 -0
  25. {datago-2025.3.11 → datago-2025.3.12}/src/structs.rs +0 -0
  26. {datago-2025.3.11 → datago-2025.3.12}/src/worker_files.rs +0 -0
  27. {datago-2025.3.11 → datago-2025.3.12}/src/worker_http.rs +0 -0
  28. {datago-2025.3.11 → datago-2025.3.12}/tests/client_test.rs +0 -0
@@ -387,7 +387,7 @@ dependencies = [
387
387
 
388
388
  [[package]]
389
389
  name = "datago"
390
- version = "2025.3.11"
390
+ version = "2025.3.12"
391
391
  dependencies = [
392
392
  "clap",
393
393
  "image",
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "datago"
3
3
  edition = "2021"
4
- version = "2025.3.11"
4
+ version = "2025.3.12"
5
5
 
6
6
  [lib]
7
7
  # exposed by pyo3
@@ -14,7 +14,7 @@ name = "datago"
14
14
  path = "src/main.rs"
15
15
 
16
16
  [dependencies]
17
- image = "0.25.5"
17
+ image = { version = "0.25.5", features = ["png"]}
18
18
  reqwest = { version = "0.12.12", features = ["blocking"] }
19
19
  serde = { version = "1.0", features = ["derive"] }
20
20
  serde_json = "1.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datago
3
- Version: 2025.3.11
3
+ Version: 2025.3.12
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -1,8 +1,8 @@
1
1
  use crate::structs::ImagePayload;
2
+ use image::ImageEncoder;
2
3
  use serde::Deserialize;
3
4
  use serde::Serialize;
4
5
  use std::io::Cursor;
5
-
6
6
  // --- Sample data structures - these will be exposed to the Python world ---------------------------------------------------------------------------------------------------------------------------------------------------------------
7
7
 
8
8
  #[derive(Debug, Serialize, Deserialize)]
@@ -176,15 +176,24 @@ pub async fn image_to_payload(
176
176
  // Encode the image if needed
177
177
  let mut image_bytes: Vec<u8> = Vec::new();
178
178
  if encode_images {
179
- if image
180
- .write_to(&mut Cursor::new(&mut image_bytes), image::ImageFormat::Png)
181
- .is_err()
182
- {
183
- return Err(image::ImageError::IoError(std::io::Error::new(
179
+ // Use the encoder directly with the raw bytes
180
+ image::codecs::png::PngEncoder::new_with_quality(
181
+ &mut Cursor::new(&mut image_bytes),
182
+ image::codecs::png::CompressionType::Fast,
183
+ image::codecs::png::FilterType::Adaptive,
184
+ )
185
+ .write_image(
186
+ image.as_bytes(),
187
+ image.width(),
188
+ image.height(),
189
+ image.color().into(),
190
+ )
191
+ .map_err(|e| {
192
+ image::ImageError::IoError(std::io::Error::new(
184
193
  std::io::ErrorKind::Other,
185
- "Failed to encode image",
186
- )));
187
- }
194
+ e.to_string(),
195
+ ))
196
+ })?;
188
197
 
189
198
  channels = -1; // Signal the fact that the image is encoded
190
199
  } else {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes