Skip to content

Conversation

@dessalines
Copy link

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran prettier on this file also.

Copy link
Member

@rubdos rubdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also noticed now that decode_image is not shown in docs.

README.md Outdated
Comment on lines 59 to 70
If you'd like to convert this image to a base64 `png`, you can add the `base64` and `image` crates, then do:

```rust
use base64::{engine::general_purpose, Engine as _};
use std::io::Cursor;

let mut bytes: Vec<u8> = Vec::new();
image_buffer.write_to(&mut Cursor::new(&mut bytes), image::ImageOutputFormat::Png).unwrap();

let b64_png = general_purpose::STANDARD.encode(bytes);
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't include this. The whole purpose of blurhash is to have a succinct representation of an image, and this method does the exact opposite: it decodes our succinct representation into an image, then recompresses as a png, and then blows up the file through base64.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K, removed that block now.

src/lib.rs Outdated
Comment on lines 32 to 42
//! If you'd like to convert this image to a base64 `png`, you can add the `base64` and `image` crates, then do:
//!
//! ```no_run
//! use base64::{engine::general_purpose, Engine as _};
//! use std::io::Cursor;
//!
//! let mut bytes: Vec<u8> = Vec::new();
//! image_buffer.write_to(&mut Cursor::new(&mut bytes), image::ImageOutputFormat::Png).unwrap();
//!
//! let b64_png = general_purpose::STANDARD.encode(bytes);
//! ```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. This is not an approach I want to recommend to users of this crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How do convert the decoded result to a base64 encoded image?

2 participants