20 lines
887 B
Python
20 lines
887 B
Python
from PIL import Image, ImageDraw, ImageFont
|
||
import arabic_reshaper
|
||
from bidi.algorithm import get_display
|
||
|
||
img = Image.new('RGB', (1080, 1080), '#0F172A')
|
||
draw = ImageDraw.Draw(img)
|
||
|
||
font_path = '/workspace/personal/dashboards/VPN_chanel/backend/app/static/fonts/Vazirmatn-Bold.ttf'
|
||
font_title = ImageFont.truetype(font_path, 48)
|
||
font_price = ImageFont.truetype(font_path, 36)
|
||
|
||
text_farsi = get_display(arabic_reshaper.reshape("ارتقای لول کارها با Google Gemini Pro"))
|
||
price_farsi = get_display(arabic_reshaper.reshape("تخفیف ویژه: ۶۰۰,۰۰۰ تومان"))
|
||
|
||
draw.text((540, 200), text_farsi, font=font_title, fill='#FFFFFF', anchor='mm')
|
||
draw.rounded_rectangle([290, 500, 790, 590], radius=45, fill='#F59E0B')
|
||
draw.text((540, 545), price_farsi, font=font_price, fill='#000000', anchor='mm')
|
||
|
||
img.save('/tmp/test_pillow_farsi.png')
|
||
print("Saved pillow image")
|