adaptemoji

Crates.ioadaptemoji
lib.rsadaptemoji
version0.1.1
sourcesrc
created_at2024-03-27 00:22:39.436315
updated_at2024-03-27 01:56:12.039769
descriptionConvert your regular Telegram emojis into adaptive monochrome versions
homepagehttps://github.com/adaptemoji/adaptemoji
repositoryhttps://github.com/adaptemoji/adaptemoji
max_upload_size
id1187399
size43,190
Aleksei Rybin (tapnisu)

documentation

https://docs.rs/adaptemoji

README

Adaptemoji

Convert your regular Telegram emojis into adaptive monochrome versions

Examples

Original Adaptive Adaptive negative
Original image Adaptive image Adaptive negative image

As you can see, one of the adaptive versions looks wrong compared to original. But, if you switch your color theme from light to dark (or dark to light) the other one will be wrong. So, you need to use the one, that fits your background more.

Requirements

  1. CC linker (Windows - Microsoft Visual Studio with C++ Support) (Linux - gcc)

  2. Rust

Installation

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) // Resize image to 100px x 100px
        .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) // Resize image to 100px x 100px
        .to_luma_alpha8();

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

    Ok(())
}
Commit count: 16

cargo fmt