Helpful In Write Correct Punjabi/Gurmukhi On Images, Pdf, Kivy & Others.
Project description
Python Gurmukhi / Punjabi
During Image Processing, Pdf Writing Or Android Dvolpment Some Errors Occur Because Python Don't Render Gurmukhi Languge Correctly. This Package Is Helpfull In Process That All Charecters Correctly.
INSTALLATION
Using Pip Or Pip3
pip install pi7gurmukhi
Pi7Gurmukhi Font
pi7font Is A TTF(True Type Font) File Which Is Used For Process & Display Correct Text.
You Can Download it From Here pi7gurmukhi.ttf
Or Check Github
How To Use?
We Will See How To Write Gurmukhi Font On Image With The Help Of Pillow Library.
render_gurmukhi
Function Is Used To Modify Gurmukhi String & pi7gurmukhi.ttf
File Is Used For Display Output
NOTE
Dont Forget To Download pi7gurmukhi.ttf
File And Use In Code.
# -*- coding: utf-8 -*-
from pi7gurmukhi import render_gurmukhi
from PIL import Image, ImageDraw, ImageFont
# Dont Forget To Include pi7gurmukhi.ttf File Path Otherwise It Will Don't Work
Pi7TTfFile = "Path/To/pi7gurmukhi.ttf"
# Use render_gurmukhi Function For Correct Output
punjabi_text = render_gurmukhi(u"ਸ੍ਰੀ ਗੁਰੂ ਨਾਨਕ ਦੇਵ ਜੀ \nਸ੍ਰੀ ਮੁਕਤਸਰ ਸਾਹਿਬ")
font_size=36
width=350
height=130
back_ground_color=(255,255,255)
font_color=(0,0,0)
im = Image.new ("RGB", (width,height), back_ground_color)
draw = ImageDraw.Draw (im)
unicode_font = ImageFont.truetype(Pi7TTfFile, font_size)
draw.text((10,10), punjabi_text, font=unicode_font, fill=font_color )
im.save("text.jpg")
Output Using Pi7Gurmukhi Font And render_gurmukhi Function
This Is Correct Output
Output Without Pi7Gurmukhi Font And render_gurmukhi Function
This Is Incorrect Output Without Pi7Gurmukhi Font And Function.
Similarly You Can Use pi7gurmukhi
For Write Pdf Files, Devolpment Using Kivy, Tkinter etc.
For Any Another Information Contact To bhullarshivjeet@gmail.com
Or Message Me On Linkedin
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file pi7gurmukhi-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: pi7gurmukhi-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5e2c9489d3e48ff356d8219c7191dc7cc1fdade6917d96e9f8f5782bb12ae51 |
|
MD5 | f6ede0222b5fe4982330bc07b3ed5331 |
|
BLAKE2b-256 | 15a25f85705c0dcf5af1feb91416bebdb11cb21e741e296a1b6181cadb07023f |