usc 1.20230730.1349

A common lib for unitedservices
Documentation
//
//
// //use ravif::*;
// use image::{open};
// use load_image::export::rgb::RGBA;
//
// pub async fn main() -> std::io::Result<()> {
//     let img = open("/Users/wangruihong/Downloads/60aa22ef9a5569340bd73a547d6d38a31a6314e34dbc04418189397bbb5a9bfb.gif").unwrap();
//
//     // Convert the image to RGB.
//     let rgba_img = img.to_rgba8();
//
//     // Get the dimensions of the image.
//     let (width, height) = rgba_img.dimensions();
//     println!("Width: {}, Height: {}", width, height);
//
//     let mut raw_pixels: Vec<RGBA<u8>> = Vec::new();
//     for pixel in rgba_img.pixels() {
//         let p = RGBA {
//             r: pixel[0],
//             g: pixel[1],
//             b: pixel[2],
//             a: pixel[3],
//         };
//         raw_pixels.push(p);
//     }
//
//     // Now you have the raw pixel data in the `raw_pixels` vector.
//     // You can get a slice with the following:
//     let raw_pixels_slice: &[RGBA<u8>] = &raw_pixels;
//
//
//     let res = Encoder::new()
//         .with_speed(10)
//         .encode_rgba(Img::new(raw_pixels_slice, width as usize, height as usize)).unwrap();
//     let _=std::fs::write("/Users/wangruihong/Downloads/hello.avif", res.avif_file);
//     Ok(())
// }