pilmoji


Namepilmoji JSON
Version 2.0.4 PyPI version JSON
download
home_pagehttps://github.com/jay3332/pilmoji
SummaryPilmoji is an emoji renderer for Pillow, Python's imaging library.
upload_time2023-08-10 02:56:10
maintainer
docs_urlNone
authorjay3332
requires_python>=3.8.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pilmoji
Pilmoji is an emoji renderer for [Pillow](https://github.com/python-pillow/Pillow/), 
Python's imaging library.

Pilmoji comes equipped with support for both unicode emojis and Discord emojis.

## Features
- Discord emoji support
- Multi-line rendering support
- Emoji position and/or size adjusting
- Many built-in emoji sources
- Optional caching

## Installation and Requirements
You must have Python 3.8 or higher in order to install Pilmoji.

Installation can be done with `pip`:
```shell 
$ pip install -U pilmoji
```

Optionally, you can add the `[requests]` option to install requests
alongside Pilmoji:
```shell 
$ pip install -U pilmoji[requests]
```

The option is not required, instead if `requests` is not installed, 
Pilmoji will fallback to use the builtin `urllib`.

You may also install from Github.

## Usage
```py 
from pilmoji import Pilmoji
from PIL import Image, ImageFont


my_string = '''
Hello, world! 👋 Here are some emojis: 🎨 🌊 😎
I also support Discord emoji: <:rooThink:596576798351949847>
'''

with Image.new('RGB', (550, 80), (255, 255, 255)) as image:
    font = ImageFont.truetype('arial.ttf', 24)

    with Pilmoji(image) as pilmoji:
        pilmoji.text((10, 10), my_string.strip(), (0, 0, 0), font)

    image.show()
```

#### Result
![Example result](https://jay.has-no-bra.in/f/j4iEcc.png)

## Switching emoji sources
As seen from the example, Pilmoji defaults to the `Twemoji` emoji source. 

If you prefer emojis from a different source, for example Microsoft, simply
set the `source` kwarg in the constructor to a source found in the 
`pilmoji.source` module:

```py 
from pilmoji.source import MicrosoftEmojiSource

with Pilmoji(image, source=MicrosoftEmojiSource) as pilmoji:
    ...
```

![results](https://jay.has-no-bra.in/f/suPfj0.png)

It is also possible to create your own emoji sources via subclass.

## Fine adjustments
If an emoji looks too small or too big, or out of place, you can make fine adjustments 
with the `emoji_scale_factor` and `emoji_position_offset` kwargs:

```py 
pilmoji.text((10, 10), my_string.strip(), (0, 0, 0), font,
             emoji_scale_factor=1.15, emoji_position_offset=(0, -2))
```

## Contributing
Contributions are welcome. Make sure to follow [PEP-8](https://www.python.org/dev/peps/pep-0008/)
styling guidelines.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jay3332/pilmoji",
    "name": "pilmoji",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "jay3332",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/e1/04/e463218cffa0d8e145aa3c5fb409e483134df69ccfdce02bff0e05bce08e/pilmoji-2.0.4.tar.gz",
    "platform": null,
    "description": "# Pilmoji\nPilmoji is an emoji renderer for [Pillow](https://github.com/python-pillow/Pillow/), \nPython's imaging library.\n\nPilmoji comes equipped with support for both unicode emojis and Discord emojis.\n\n## Features\n- Discord emoji support\n- Multi-line rendering support\n- Emoji position and/or size adjusting\n- Many built-in emoji sources\n- Optional caching\n\n## Installation and Requirements\nYou must have Python 3.8 or higher in order to install Pilmoji.\n\nInstallation can be done with `pip`:\n```shell \n$ pip install -U pilmoji\n```\n\nOptionally, you can add the `[requests]` option to install requests\nalongside Pilmoji:\n```shell \n$ pip install -U pilmoji[requests]\n```\n\nThe option is not required, instead if `requests` is not installed, \nPilmoji will fallback to use the builtin `urllib`.\n\nYou may also install from Github.\n\n## Usage\n```py \nfrom pilmoji import Pilmoji\nfrom PIL import Image, ImageFont\n\n\nmy_string = '''\nHello, world! \ud83d\udc4b Here are some emojis: \ud83c\udfa8 \ud83c\udf0a \ud83d\ude0e\nI also support Discord emoji: <:rooThink:596576798351949847>\n'''\n\nwith Image.new('RGB', (550, 80), (255, 255, 255)) as image:\n    font = ImageFont.truetype('arial.ttf', 24)\n\n    with Pilmoji(image) as pilmoji:\n        pilmoji.text((10, 10), my_string.strip(), (0, 0, 0), font)\n\n    image.show()\n```\n\n#### Result\n![Example result](https://jay.has-no-bra.in/f/j4iEcc.png)\n\n## Switching emoji sources\nAs seen from the example, Pilmoji defaults to the `Twemoji` emoji source. \n\nIf you prefer emojis from a different source, for example Microsoft, simply\nset the `source` kwarg in the constructor to a source found in the \n`pilmoji.source` module:\n\n```py \nfrom pilmoji.source import MicrosoftEmojiSource\n\nwith Pilmoji(image, source=MicrosoftEmojiSource) as pilmoji:\n    ...\n```\n\n![results](https://jay.has-no-bra.in/f/suPfj0.png)\n\nIt is also possible to create your own emoji sources via subclass.\n\n## Fine adjustments\nIf an emoji looks too small or too big, or out of place, you can make fine adjustments \nwith the `emoji_scale_factor` and `emoji_position_offset` kwargs:\n\n```py \npilmoji.text((10, 10), my_string.strip(), (0, 0, 0), font,\n             emoji_scale_factor=1.15, emoji_position_offset=(0, -2))\n```\n\n## Contributing\nContributions are welcome. Make sure to follow [PEP-8](https://www.python.org/dev/peps/pep-0008/)\nstyling guidelines.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pilmoji is an emoji renderer for Pillow, Python's imaging library.",
    "version": "2.0.4",
    "project_urls": {
        "Discord": "https://discord.gg/FqtZ6akWpd",
        "Homepage": "https://github.com/jay3332/pilmoji",
        "Issue tracker": "https://github.com/jay3332/pilmoji"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "477cb7139e422e460889077d34b8e668b7b61af19e303b7a66adc736313fb71a",
                "md5": "8082e935cbc4161752214db63b6fbfe3",
                "sha256": "2fcb2116226ed8aa600fcf6e65d7693b5d08d60715f8c460553130081a5adc26"
            },
            "downloads": -1,
            "filename": "pilmoji-2.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8082e935cbc4161752214db63b6fbfe3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 9709,
            "upload_time": "2023-08-10T02:56:09",
            "upload_time_iso_8601": "2023-08-10T02:56:09.123745Z",
            "url": "https://files.pythonhosted.org/packages/47/7c/b7139e422e460889077d34b8e668b7b61af19e303b7a66adc736313fb71a/pilmoji-2.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e104e463218cffa0d8e145aa3c5fb409e483134df69ccfdce02bff0e05bce08e",
                "md5": "47f9aa4da933c597d1dcf15f1529a88d",
                "sha256": "3861c09999f36bb32dd559e181b63a8a9c8068b2cddcac32637581e48de2d11f"
            },
            "downloads": -1,
            "filename": "pilmoji-2.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "47f9aa4da933c597d1dcf15f1529a88d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0",
            "size": 9952,
            "upload_time": "2023-08-10T02:56:10",
            "upload_time_iso_8601": "2023-08-10T02:56:10.878263Z",
            "url": "https://files.pythonhosted.org/packages/e1/04/e463218cffa0d8e145aa3c5fb409e483134df69ccfdce02bff0e05bce08e/pilmoji-2.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-10 02:56:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jay3332",
    "github_project": "pilmoji",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pilmoji"
}
        
Elapsed time: 0.10553s