Skip to main content

Present Characters as Pixel Emoji

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nazli-1.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nazli-1.0.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file nazli-1.0.0.tar.gz.

File metadata

  • Download URL: nazli-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for nazli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 243626044a1635db2deeb26df34ab26555c984773cbb79c7a51ec9b1b10f9a97
MD5 c57072a52faa5bf74c01c5bdbab418cb
BLAKE2b-256 c6ce6677bc35661dcff969a90861415a14ee799a0f05540a74fe68c89ea8e2fb

See more details on using hashes here.

File details

Details for the file nazli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nazli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for nazli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bff49f0fc64ba39df8fea977e803ef439a16ad5334e13247a4350deefcf273b
MD5 2944cbb3b038664204fda7dab2fad2b4
BLAKE2b-256 ade6ec39d974d0906ca2e005216c36f15a0294673396568e055676d624faba37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page