Skip to main content

A simple python library to put text into an image.

Project description

license enter image description here

Text2Aks

This project is under active development and anything can change in the future


What is text2aks ?

Text2Aks is a simple library that can generate simple pictures with text input.


Installing

Install and update using pip:

$ pip install text2aks


How dose it work ?

You have to have Pillow installed on your system. In the below example I will show you how can you genrate image with text2aks

from text2aks import Text2Aks, Fonts
from text2aks.elements import make_darker
from PIL import Image

my_image = 'path to my image'
text : str = "Nothing is more difficult, and therefore more precious, than to be able to decide"
wrtier_of_text : str = 'Napoleon Bonaparte'

with Image.open(my_image) as raw_image :
    darker_image = make_darker(raw_image)
    image_maker = Text2Aks(darker_image , Fonts.VAZIR_BOLD , font_size=50)
    image_maker.genrate(text , wrtier_of_text , 'ltr') # left ro right (ltr) | right to left (rtl)
    result : Image.Image = image_maker.resault()
    # If you want to save it in your file system you can use save method of Image class
    # or if you want just takes a look at it you can use show method.
    # result.save('name of new image , 'JPEG')
    # result.show()

Result image enter image description here

You can find all available fonts for this project in the fonts_data moduel The only available font in this version of the project, is Vazir font. it's an open-source and free font that you can use it in your projects.

You can use different weights of it in this project :

from text2aks.fonts_data import  Fonts

Fonts.VAZIR_BLACK  # "Vazirmatn-Black.ttf"
Fonts.VAZIR_BOLD  # "Vazirmatn-Bold.ttf"
Fonts.VAZIR_EXTRABOLD  # "Vazirmatn-ExtraBold.ttf"
Fonts.VAZIR_EXTRALIGHT  # "Vazirmatn-ExtraLight.ttf"
Fonts.VAZIR_LIGHT  # "Vazirmatn-Light.ttf"
Fonts.VAZIR_MEDIUM  # "Vazirmatn-Medium.ttf"
Fonts.VAZIR_REGULAR  # "Vazirmatn-Regular.ttf"
Fonts.VAZIR_SEMIBOLD  # "Vazirmatn-SemiBold.ttf"
Fonts.VAZIR_THIN  # "Vazirmatn-Thin.ttf"

LICENSE

MIT License

Copyright (c) 2022 Iman Hosseini Pour

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

text2aks-0.1.1a1.tar.gz (618.5 kB view hashes)

Uploaded Source

Built Distribution

text2aks-0.1.1a1-py3-none-any.whl (619.2 kB view hashes)

Uploaded Python 3

Supported by

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