Open anton-sviridov opened 2 weeks ago
We have:
In issues #7 and #9 this image file is needed, so we can implement them before step 2
image::save_buffer("image.png", buffer, 800, 600, image::ExtendedColorType::Rgb8).unwrap()
Test:
$ wget https://www.gstatic.com/webp/gallery/1.webp -O test.webp
$ retina-cli detect --image test.webp ...
# data:image/webp;base64,UklGRmh2AABXRUJQVlA
finished, test is failed now
future test -- compare results from retina-cli and retina-tauri
Test passed:
cargo install dataurl
dataurl -i miscommunication2-337x426.webp -b --media-type "image/webp"
Input: image filepath Output: base64 Data URL
Steps:
1. Get an image from path
To manipulate image operations in filesystem i will use crate image and its function image::open(), because it returns ImageResult\<DynamicImage> as we need in next step
2. Convert the image to webp
To convert image to webp I will use crate "webp":
3. Convert webp to [u8]
As input to base64_url::encode() [u8] in next step is required.
Possibly,
as_bytes(&self) -> &[u8]
solute this4. Encode [u8] to Data URL
To do this step we need function
base64_url::encode
in crate base64_url