Crates.io | wcloud |
lib.rs | wcloud |
version | 0.1.0 |
source | src |
created_at | 2023-09-06 02:28:13.907715 |
updated_at | 2023-09-06 02:28:13.907715 |
description | Generate beautiful word clouds with support for masks, custom fonts, custom coloring functions, and more. |
homepage | |
repository | https://github.com/isaackd/wcloud |
max_upload_size | |
id | 964967 |
size | 8,118,777 |
Generate beautiful word clouds with support for masks, custom fonts, custom coloring functions, and more.
Currently, the only way to install wcloud
is by installing Rust and using Cargo.
cargo install wcloud
wcloud
can be used as both a command-line application and a library.
The binary runs under the wcloud
name. The only required input is the text used to generate the word cloud, which can be provided via the --text
flag or through stdin
.
$ wcloud --text file.txt -o cloud.png
$ echo 'Clouds are awesome!' | wcloud --output cloud.png
For a list of all options, use wcloud --help
.
wcloud
can also be used as a Rust crate. cargo add wcloud
to add it as a dependency. The documentation is available here.
Here's a basic example:
use wcloud::{WordCloud, WordCloudSize};
fn main() {
let text = r#"
An arcus cloud is a low, horizontal cloud formation,
usually appearing as an accessory cloud to a cumulonimbus.
Roll clouds and shelf clouds are the two main types of arcus
clouds. They most frequently form along the leading edge or
gust fronts of thunderstorms; some of the most dramatic arcus
formations mark the gust fronts of derecho-producing convective
systems. Roll clouds may also arise in the absence of
thunderstorms, forming along the shallow cold air currents of
some sea breeze boundaries and cold fronts.
"#;
let wordcloud = WordCloud::default()
.with_rng_seed(0);
let size = WordCloudSize::FromDimensions { width: 1000, height: 500 };
let wordcloud_image = wordcloud.generate_from_text(text, size, 1.0);
wordcloud_image.save("cloud.png")
.expect("Unable to save image");
}
Examples of generating word clouds with masks, custom colors, and other features can be found in the examples/
directory.
This project is largely based on the word_cloud project by @amueller. Comparatively, wcloud
is missing the following features:
wcloud
is released under the MIT License. The default Ubuntu
font is included under the Ubuntu Font License and Droid Sans Mono
under Apache License 2.