Skip to main content

Crate adaptemoji

Crate adaptemoji 

Source
Expand description

§Adaptemoji

Convert your regular Telegram emojis into adaptive monochrome versions

§Installation as CLI

cargo install adaptemoji

§How to use

§Regular

adaptemoji -i your-image.png -o output-image.png

§Negative

adaptemoji -i your-image.png -o output-image.png -n

Also Telegram requires your emoji to be 100px x 100px in size. If you want adaptemoji automatically to resize image, add -r flag

§Regular resized

adaptemoji -i your-image.png -o output-image.png -r

§Negative resized

adaptemoji -i your-image.png -o output-image.png -nr

§Using as library

§Installation

cargo add adaptemoji

§Examples

use adaptemoji::AdaptiveEmojiConvert;
use std::error;

fn main() -> Result<(), Box<dyn error::Error>> {
    let img = image::open("./assets/examples/original.webp")?;
    let mut resized_img = img
        .resize(100, 100, image::imageops::FilterType::Triangle)
        .to_luma_alpha8();

    resized_img.convert_adaptive(false).save("./target/adaptive.png")?;

    Ok(())
}
use adaptemoji::AdaptiveEmojiConvert;
use std::error;

fn main() -> Result<(), Box<dyn error::Error>> {
    let img = image::open("./assets/examples/original.webp")?;
    let mut resized_img = img
        .resize(100, 100, image::imageops::FilterType::Triangle)
        .to_luma_alpha8();

    adaptemoji::convert_adaptive(&mut resized_img, true);
    resized_img.save("./target/adaptive_negative.png")?;

    Ok(())
}

Modules§

cli
Utils for adaptemoji CLI

Traits§

AdaptiveEmojiConvert
Convert your emoji into adaptive one

Functions§

convert_adaptive
Converts the pixels of a GrayAlphaImage to negative if negative is true, otherwise, converts them to positive.