#image-resizing #image-compression #zip-file #zip #image #resize #jpeg

bin+lib zipimgzip

Resize and ZipArchive the images in the Zip

11 releases

0.4.2 Sep 22, 2024
0.4.1 Sep 21, 2024
0.3.1 Jan 8, 2023
0.3.0 Nov 4, 2022
0.1.2 Oct 25, 2022

#396 in Images

Download history 418/week @ 2024-09-16 93/week @ 2024-09-23 51/week @ 2024-09-30

431 downloads per month

MIT/Apache

38KB
836 lines

zipimgzip

Resize and ZipArchive the images in the Zip.
(Zip -> Image -> ResizeImage -> Zip )

Example

Resize the images in the zip file to the specified size and compress them into a zip file

 fn main() -> Result<(), io::Error> {
 let test_path = String::from("C:\\test\\original.zip");
 let test_outpath = String::from("C:\\test\\conv.zip");
 let test_pixels: [u32; 2] = [750, 1334];
 let test_quality: u8 = 90;

 let _ = unzip_to_memory(test_path, PrintMode::Print)?
 .convert_size(test_pixels[0], test_pixels[1], ConvMode::Height)?
 .create_zip(test_outpath, SaveFormat::Ref, test_quality)?;
 
 return Ok(());
 }

MultiThread exmanple

 fn main() -> Result<(), io::Error> {
 let test_pixels: [u32; 2] = [750, 1334];
 let test_quality: u8 = 90;
 let test_path = String::from("C:\\test\\test.zip");
 let test_outpath = String::from("C:\\test\\conv.zip");

 let _ = unzip_to_memory(test_path, PrintMode::Print)?
     .convert_size_multithread(test_pixels[0], test_pixels[1], ConvMode::Height)?
     .create_zip_multithread(test_outpath, SaveFormat::Ref, test_quality)?;

return Ok(())
}

Support

Jpeg/Jpg/Png/Avif bmp/gif/tiff/webp ->convert jpg

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~28–39MB
~747K SLoC