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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file text2aks-0.1.1a1.tar.gz.

File metadata

  • Download URL: text2aks-0.1.1a1.tar.gz
  • Upload date:
  • Size: 618.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.15.0-47-generic

File hashes

Hashes for text2aks-0.1.1a1.tar.gz
Algorithm Hash digest
SHA256 34598eea81260c3661ea4951bd375b252356f07cf00feb1b62bb760d0c7e4fb9
MD5 c2f5b5c7fe598d05ba52aebcf2ffc314
BLAKE2b-256 f4643d56fb63edfe4cbaa709438ae3af8d40eeb174ed25b934ee7f2b144d61ce

See more details on using hashes here.

File details

Details for the file text2aks-0.1.1a1-py3-none-any.whl.

File metadata

  • Download URL: text2aks-0.1.1a1-py3-none-any.whl
  • Upload date:
  • Size: 619.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.15.0-47-generic

File hashes

Hashes for text2aks-0.1.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d58a2a3f0578b48ae905de078c9d0b8ad1b81058ef1fa7ec6991dda69c0593
MD5 8f2f7d0950f3df2f533a9ac6a737ae69
BLAKE2b-256 4e8ded243be4a298e25edab478df1bc56e3b770a1d399648d9e00fced0dd6424

See more details on using hashes here.

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