Skip to main content

Nazli - Word to Pixel Emoji

This Python project converts text into pixel-art-style emojis, transforming each character into a creative and visually appealing grid of emojis.

Features

  • Pixel Art Transformation: Converts words into pixel-art-style emoji grids.
  • Customizable Emojis: Choose your own emojis for the "filled" and "empty" parts of the pixel art.
  • Flexible Input: Handles multi-character words and adjusts spacing based on emoji width.
  • Simple Integration: Designed for easy integration into larger projects or standalone use.

Usage

  1. Clone the repository:

    git clone https://github.com/kamyarmg/nazli.git
    cd nazli
    
  2. Import the module into your project:

    from nazli import word_to_pixel_emoji
    
    print(word_to_pixel_emoji("I", filled_emoji="🌺"))
    print(word_to_pixel_emoji("Wish", filled_emoji="🌸"))
    print(word_to_pixel_emoji("You", filled_emoji="🧊"))
    print(word_to_pixel_emoji("The", filled_emoji="🍀"))
    print(word_to_pixel_emoji("Best.", filled_emoji="🌟"))
    

Output Example:

  🌺🌺🌺
    🌺
    🌺
    🌺
  🌺🌺🌺

🌸      🌸    🌸🌸🌸      🌸🌸🌸🌸  🌸      🌸
🌸      🌸      🌸      🌸          🌸      🌸
🌸  🌸  🌸      🌸        🌸🌸🌸    🌸🌸🌸🌸🌸
🌸🌸  🌸🌸      🌸              🌸  🌸      🌸
🌸      🌸    🌸🌸🌸    🌸🌸🌸🌸    🌸      🌸

🧊      🧊    🧊🧊🧊    🧊      🧊
  🧊  🧊    🧊      🧊  🧊      🧊
    🧊      🧊      🧊  🧊      🧊
    🧊      🧊      🧊  🧊      🧊
    🧊        🧊🧊🧊      🧊🧊🧊

🍀🍀🍀🍀🍀  🍀      🍀  🍀🍀🍀🍀🍀
    🍀      🍀      🍀  🍀
    🍀      🍀🍀🍀🍀🍀  🍀🍀🍀🍀
    🍀      🍀      🍀  🍀
    🍀      🍀      🍀  🍀🍀🍀🍀🍀

🌟🌟🌟🌟    🌟🌟🌟🌟🌟    🌟🌟🌟🌟  🌟🌟🌟🌟🌟
🌟      🌟  🌟          🌟              ‌ 🌟
🌟🌟🌟🌟    🌟🌟🌟🌟      🌟🌟🌟        🌟
🌟      🌟  🌟                  🌟       🌟
🌟🌟🌟🌟    🌟🌟🌟🌟🌟  🌟🌟🌟🌟        🌟          🌟



Key Functions

  1. word_to_pixel_emoji(word: str, filled_emoji: str = "🌸") -> str

    • Converts a word into a grid of pixel emoji art.

    • Parameters:

      • word: The text to convert.
      • filled_emoji: The emoji to use for the filled portions of the grid (default: 🌸).
    • Returns:

      • A string containing the pixel-art emoji representation of the word.
  2. char_to_pixel_emoji(char: str, filled_emoji: str, empty_emoji: str) -> list[str] | None

    • Converts a single character to a pixel-art representation.
    • Returns None if the character is not in the pixel map.
  3. emoji_length(emoji: str) -> int

    • Calculates the visual width of an emoji based on its Unicode properties.

Pixel Map

The pixel map for each character is stored in PIXEL_MAP and defines how each letter is visualized. You can customize this mapping by updating the pixel_art.py module.

Example Mapping

PIXEL_MAP = {
    "A": [
        "  X  ",
        " X X ",
        "XXXXX",
        "X   X",
        "X   X",
    ],
    # Add more characters...
}

Contributing

Contributions are welcome! Feel free to submit issues or pull requests to enhance the functionality or add support for additional features. For more information, please see the CONTRIBUTING.md

Metadata

Release files for nazli 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nazli 1.0.0
File Size Uploaded
nazli-1.0.0.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nazli 1.0.0
File Interpreter ABI Platform
nazli-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / nazli-1.0.0.tar.gz

Download URL nazli-1.0.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
243626044a1635db2deeb26df34ab26555c984773cbb79c7a51ec9b1b10f9a97
BLAKE2b-256 checksum
How to use checksums
c6ce6677bc35661dcff969a90861415a14ee799a0f05540a74fe68c89ea8e2fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / nazli-1.0.0-py3-none-any.whl

Download URL nazli-1.0.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bff49f0fc64ba39df8fea977e803ef439a16ad5334e13247a4350deefcf273b
BLAKE2b-256 checksum
How to use checksums
ade6ec39d974d0906ca2e005216c36f15a0294673396568e055676d624faba37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page