438 lines
20 KiB
Python
438 lines
20 KiB
Python
import math
|
||
from PIL import Image, ImageDraw, ImageFont, ImageFilter
|
||
import arabic_reshaper
|
||
from bidi.algorithm import get_display
|
||
|
||
FONT_BOLD = '/workspace/personal/dashboards/VPN_chanel/backend/app/static/fonts/Vazirmatn-Bold.ttf'
|
||
FONT_REGULAR = '/workspace/personal/dashboards/VPN_chanel/backend/app/static/fonts/Vazirmatn-Regular.ttf'
|
||
|
||
def get_font(path, size):
|
||
try:
|
||
return ImageFont.truetype(path, size)
|
||
except:
|
||
return ImageFont.load_default()
|
||
|
||
def farsi(text: str) -> str:
|
||
return get_display(arabic_reshaper.reshape(text))
|
||
|
||
# --- VECTOR ICON DRAWING FUNCTIONS (NO DEPENDENCY ON OS EMOJIS) ---
|
||
|
||
def draw_gemini_sparkle(draw, center, size, color):
|
||
# 4-point star like Google Gemini
|
||
cx, cy = center
|
||
r_outer = size // 2
|
||
r_inner = size // 6
|
||
points = []
|
||
for i in range(8):
|
||
angle = i * math.pi / 4
|
||
r = r_outer if i % 2 == 0 else r_inner
|
||
x = cx + r * math.cos(angle)
|
||
y = cy + r * math.sin(angle)
|
||
points.append((x, y))
|
||
draw.polygon(points, fill=color)
|
||
|
||
def draw_vector_lock(draw, center, size, color):
|
||
cx, cy = center
|
||
body_w = int(size * 0.75)
|
||
body_h = int(size * 0.55)
|
||
# Body
|
||
bx1 = cx - body_w // 2
|
||
by1 = cy - body_h // 6
|
||
bx2 = cx + body_w // 2
|
||
by2 = by1 + body_h
|
||
draw.rounded_rectangle([bx1, by1, bx2, by2], radius=6, fill=color)
|
||
|
||
# Shackle (loop)
|
||
shackle_r = int(size * 0.28)
|
||
draw.arc([cx - shackle_r, by1 - shackle_r * 2 + 4, cx + shackle_r, by1 + 4], start=180, end=0, fill=color, width=4)
|
||
# Keyhole
|
||
draw.ellipse([cx - 3, by1 + body_h // 3, cx + 3, by1 + body_h // 3 + 6], fill=(15, 23, 42, 255))
|
||
|
||
def draw_vector_check(draw, center, size, bg_color, check_color=(255, 255, 255)):
|
||
cx, cy = center
|
||
r = size // 2
|
||
draw.ellipse([cx - r, cy - r, cx + r, cy + r], fill=bg_color)
|
||
# Checkmark lines
|
||
p1 = (cx - r * 0.45, cy)
|
||
p2 = (cx - r * 0.1, cy + r * 0.4)
|
||
p3 = (cx + r * 0.45, cy - r * 0.35)
|
||
draw.line([p1, p2], fill=check_color, width=3)
|
||
draw.line([p2, p3], fill=check_color, width=3)
|
||
|
||
def draw_vector_cross(draw, center, size, bg_color, cross_color=(255, 255, 255)):
|
||
cx, cy = center
|
||
r = size // 2
|
||
draw.ellipse([cx - r, cy - r, cx + r, cy + r], fill=bg_color)
|
||
d = r * 0.35
|
||
draw.line([(cx - d, cy - d), (cx + d, cy + d)], fill=cross_color, width=3)
|
||
draw.line([(cx - d, cy + d), (cx + d, cy - d)], fill=cross_color, width=3)
|
||
|
||
def draw_vector_shield(draw, center, size, color):
|
||
cx, cy = center
|
||
w = int(size * 0.8)
|
||
h = size
|
||
x1, y1 = cx - w//2, cy - h//2
|
||
x2, y2 = cx + w//2, cy + h//2
|
||
# shield polygon
|
||
pts = [
|
||
(cx - w//2, y1),
|
||
(cx + w//2, y1),
|
||
(cx + w//2, cy + h*0.1),
|
||
(cx, y2),
|
||
(cx - w//2, cy + h*0.1)
|
||
]
|
||
draw.polygon(pts, fill=color)
|
||
|
||
def draw_vector_lightning(draw, center, size, color):
|
||
cx, cy = center
|
||
s = size // 2
|
||
pts = [
|
||
(cx + s*0.2, cy - s),
|
||
(cx - s*0.6, cy + s*0.05),
|
||
(cx - s*0.05, cy + s*0.05),
|
||
(cx - s*0.2, cy + s),
|
||
(cx + s*0.6, cy - s*0.05),
|
||
(cx + s*0.05, cy - s*0.05),
|
||
]
|
||
draw.polygon(pts, fill=color)
|
||
|
||
def create_radial_glow(width, height, center_x, center_y, radius, color):
|
||
glow = Image.new('RGBA', (width, height), (0, 0, 0, 0))
|
||
draw = ImageDraw.Draw(glow)
|
||
r, g, b, max_a = color
|
||
steps = 35
|
||
for i in range(steps, 0, -1):
|
||
cur_r = radius * (i / steps)
|
||
alpha = int(max_a * (1 - (i / steps)) ** 1.6)
|
||
draw.ellipse([center_x - cur_r, center_y - cur_r, center_x + cur_r, center_y + cur_r], fill=(r, g, b, alpha))
|
||
return glow.filter(ImageFilter.GaussianBlur(radius // 5))
|
||
|
||
def draw_rounded_glass_card(img, bbox, bg_color, border_color, radius=28, shadow=True):
|
||
x1, y1, x2, y2 = bbox
|
||
if shadow:
|
||
shadow_layer = Image.new('RGBA', img.size, (0, 0, 0, 0))
|
||
sdraw = ImageDraw.Draw(shadow_layer)
|
||
sdraw.rounded_rectangle([x1 + 4, y1 + 10, x2 - 4, y2 + 18], radius=radius, fill=(0, 0, 0, 130))
|
||
shadow_layer = shadow_layer.filter(ImageFilter.GaussianBlur(16))
|
||
img.alpha_composite(shadow_layer)
|
||
|
||
card_layer = Image.new('RGBA', img.size, (0, 0, 0, 0))
|
||
cdraw = ImageDraw.Draw(card_layer)
|
||
cdraw.rounded_rectangle([x1, y1, x2, y2], radius=radius, fill=bg_color, outline=border_color, width=2)
|
||
cdraw.line([(x1 + radius, y1 + 1), (x2 - radius, y1 + 1)], fill=(255, 255, 255, 60), width=2)
|
||
img.alpha_composite(card_layer)
|
||
|
||
def draw_pill_button(img, bbox, fill_grad_start, fill_grad_end, text, subtext=None, text_color='#000000'):
|
||
x1, y1, x2, y2 = bbox
|
||
# Deep shadow
|
||
shadow_layer = Image.new('RGBA', img.size, (0, 0, 0, 0))
|
||
sdraw = ImageDraw.Draw(shadow_layer)
|
||
sdraw.rounded_rectangle([x1 + 6, y1 + 8, x2 - 6, y2 + 18], radius=(y2 - y1)//2, fill=(0, 0, 0, 150))
|
||
sdraw.rounded_rectangle([x1 + 15, y1 + 12, x2 - 15, y2 + 24], radius=(y2 - y1)//2, fill=(fill_grad_start[0], fill_grad_start[1], fill_grad_start[2], 80))
|
||
shadow_layer = shadow_layer.filter(ImageFilter.GaussianBlur(14))
|
||
img.alpha_composite(shadow_layer)
|
||
|
||
# Button gradient
|
||
btn = Image.new('RGBA', (x2 - x1, y2 - y1), (0, 0, 0, 0))
|
||
bdraw = ImageDraw.Draw(btn)
|
||
for y in range(y2 - y1):
|
||
ratio = y / (y2 - y1)
|
||
r = int(fill_grad_start[0] * (1 - ratio) + fill_grad_end[0] * ratio)
|
||
g = int(fill_grad_start[1] * (1 - ratio) + fill_grad_end[1] * ratio)
|
||
b = int(fill_grad_start[2] * (1 - ratio) + fill_grad_end[2] * ratio)
|
||
bdraw.line([(0, y), (x2 - x1, y)], fill=(r, g, b, 255))
|
||
|
||
mask = Image.new('L', (x2 - x1, y2 - y1), 0)
|
||
mdraw = ImageDraw.Draw(mask)
|
||
mdraw.rounded_rectangle([0, 0, x2 - x1, y2 - y1], radius=(y2 - y1)//2, fill=255)
|
||
img.paste(btn, (x1, y1), mask)
|
||
|
||
odraw = ImageDraw.Draw(img)
|
||
odraw.rounded_rectangle([x1, y1, x2, y2], radius=(y2 - y1)//2, outline=(255, 255, 255, 180), width=2)
|
||
|
||
f_btn = get_font(FONT_BOLD, 36)
|
||
odraw.text(((x1 + x2)//2, (y1 + y2)//2 - (10 if subtext else 0)), farsi(text), font=f_btn, fill=text_color, anchor='mm')
|
||
|
||
if subtext:
|
||
f_sub = get_font(FONT_REGULAR, 20)
|
||
odraw.text(((x1 + x2)//2, (y1 + y2)//2 + 22), farsi(subtext), font=f_sub, fill='#1F2937', anchor='mm')
|
||
|
||
# ==============================================================================
|
||
# 1. GEMINI PRO COMPARISON BANNER (1080x1080)
|
||
# ==============================================================================
|
||
def render_gemini_banner(price_text="۶۰۰,۰۰۰ تومان", original_price="۱,۵۰۰,۰۰۰ تومان"):
|
||
W, H = 1080, 1080
|
||
base = Image.new('RGBA', (W, H), (10, 14, 26, 255))
|
||
|
||
# Atmospheric glow
|
||
glow1 = create_radial_glow(W, H, 780, 470, 480, (147, 51, 234, 85)) # Purple for Gemini
|
||
glow2 = create_radial_glow(W, H, 300, 470, 360, (59, 130, 246, 40)) # Indigo
|
||
glow3 = create_radial_glow(W, H, 540, 910, 400, (245, 158, 11, 55)) # Gold
|
||
base.alpha_composite(glow1)
|
||
base.alpha_composite(glow2)
|
||
base.alpha_composite(glow3)
|
||
|
||
draw = ImageDraw.Draw(base)
|
||
|
||
# Top Category Pill
|
||
badge_w, badge_h = 440, 46
|
||
bx1, by1 = (W - badge_w)//2, 45
|
||
draw_rounded_glass_card(base, [bx1, by1, bx1 + badge_w, by1 + badge_h], (30, 41, 59, 180), (71, 85, 105, 160), radius=23, shadow=False)
|
||
draw_gemini_sparkle(draw, (bx1 + 35, by1 + 23), 22, (245, 158, 11))
|
||
f_badge = get_font(FONT_BOLD, 21)
|
||
draw.text((W // 2 + 10, by1 + 23), farsi("پیشنهاد ویژه اشتراک رسمی هوش مصنوعی"), font=f_badge, fill='#38BDF8', anchor='mm')
|
||
|
||
# Main Headline
|
||
f_title = get_font(FONT_BOLD, 52)
|
||
f_sub = get_font(FONT_REGULAR, 24)
|
||
draw.text((W // 2, 132), farsi("جهش چشمگیر در سرعت و کیفیت پروژهها"), font=f_title, fill='#FFFFFF', anchor='mm')
|
||
draw.text((W // 2, 186), farsi("مقایسه نسخه رایگان با اشتراک اختصاصی ۱۸ ماهه Google Gemini Pro"), font=f_sub, fill='#94A3B8', anchor='mm')
|
||
|
||
# Card dimensions
|
||
card_w = 465
|
||
card_h = 590
|
||
card_top = 230
|
||
|
||
# --- LEFT CARD: FREE ---
|
||
lx1 = 55
|
||
lx2 = lx1 + card_w
|
||
ly1 = card_top
|
||
ly2 = ly1 + card_h
|
||
draw_rounded_glass_card(base, [lx1, ly1, lx2, ly2], (15, 23, 42, 220), (51, 65, 85, 180), radius=30)
|
||
|
||
# Vector Lock Icon in Header
|
||
draw.rounded_rectangle([lx1 + 30, ly1 + 28, lx1 + 90, ly1 + 88], radius=18, fill=(30, 41, 59, 255), outline=(71, 85, 105, 180), width=1)
|
||
draw_vector_lock(draw, (lx1 + 60, ly1 + 58), 34, (148, 163, 184))
|
||
|
||
f_card_title = get_font(FONT_BOLD, 30)
|
||
f_tier = get_font(FONT_BOLD, 20)
|
||
f_item = get_font(FONT_REGULAR, 21)
|
||
|
||
draw.text((lx2 - 35, ly1 + 45), farsi("نسخه معمولی"), font=f_card_title, fill='#E2E8F0', anchor='rm')
|
||
draw.text((lx2 - 35, ly1 + 76), farsi("امکانات محدود و پایه"), font=f_tier, fill='#64748B', anchor='rm')
|
||
|
||
draw.line([(lx1 + 30, ly1 + 110), (lx2 - 30, ly1 + 110)], fill=(51, 65, 85, 180), width=1)
|
||
|
||
free_items = [
|
||
"محدودیت تعداد پرسش در هر ساعت",
|
||
"عدم دسترسی به هوش مصنوعی عمیق 1.5 Pro",
|
||
"بدون فضای ابری ۲ ترابایتی گوگل",
|
||
"پایداری ضعیف در زمان اوج ترافیک",
|
||
"پاسخهای کوتاه با عمق تحلیلی کم",
|
||
"عدم یکپارچگی با ابزارهای Docs و Drive",
|
||
]
|
||
cur_y = ly1 + 155
|
||
for item in free_items:
|
||
draw_vector_cross(draw, (lx2 - 25, cur_y), 24, (239, 68, 68), (255, 255, 255))
|
||
draw.text((lx2 - 50, cur_y), farsi(item), font=f_item, fill='#94A3B8', anchor='rm')
|
||
cur_y += 58
|
||
|
||
# Left bottom footer badge
|
||
draw.rounded_rectangle([lx1 + 35, ly2 - 75, lx2 - 35, ly2 - 25], radius=15, fill=(30, 41, 59, 230), outline=(51, 65, 85, 200), width=1)
|
||
draw.text(((lx1 + lx2)//2, ly2 - 50), farsi("کاربرد آزمایشی و مقدماتی"), font=get_font(FONT_BOLD, 19), fill='#64748B', anchor='mm')
|
||
|
||
# --- RIGHT CARD: GEMINI PRO (PREMIUM) ---
|
||
rx1 = W - 55 - card_w
|
||
rx2 = rx1 + card_w
|
||
ry1 = card_top
|
||
ry2 = ry1 + card_h
|
||
|
||
draw_rounded_glass_card(base, [rx1, ry1, rx2, ry2], (24, 18, 45, 240), (168, 85, 247, 230), radius=30)
|
||
# Golden top border accent
|
||
draw.line([(rx1 + 30, ry1 + 2), (rx2 - 30, ry1 + 2)], fill=(245, 158, 11, 255), width=3)
|
||
|
||
# Vector Gemini Sparkle in Header
|
||
draw.rounded_rectangle([rx1 + 30, ry1 + 28, rx1 + 90, ry1 + 88], radius=18, fill=(88, 28, 135, 255), outline=(216, 180, 254, 200), width=1)
|
||
draw_gemini_sparkle(draw, (rx1 + 60, ry1 + 58), 40, (245, 158, 11))
|
||
|
||
draw.text((rx2 - 35, ry1 + 45), farsi("Google Gemini Pro"), font=f_card_title, fill='#FFFFFF', anchor='rm')
|
||
draw.text((rx2 - 35, ry1 + 76), farsi("اشتراک رسمی و قانونی ۱۸ ماهه"), font=f_tier, fill='#F59E0B', anchor='rm')
|
||
|
||
draw.line([(rx1 + 30, ry1 + 110), (rx2 - 30, ry1 + 110)], fill=(107, 33, 168, 200), width=1)
|
||
|
||
pro_items = [
|
||
"دسترسی ۱۸ ماهه نامحدود و رسمی",
|
||
"قدرتمندترین مدل استدلال و کدنویسی 1.5 Pro",
|
||
"۲ ترابایت فضای ابری Google One",
|
||
"فعالسازی ایمن و دائمی روی جیمیل شما",
|
||
"پایداری ۱۰۰٪ بدون قطعی در ۲۴ ساعت",
|
||
"اتصال مستقیم به Google Docs & Drive",
|
||
]
|
||
cur_y = ry1 + 155
|
||
for item in pro_items:
|
||
draw_vector_check(draw, (rx2 - 25, cur_y), 24, (16, 185, 129), (255, 255, 255))
|
||
draw.text((rx2 - 50, cur_y), farsi(item), font=f_item, fill='#F8FAFC', anchor='rm')
|
||
cur_y += 58
|
||
|
||
# Right bottom footer: Original price struck through
|
||
draw.rounded_rectangle([rx1 + 35, ry2 - 75, rx2 - 35, ry2 - 25], radius=15, fill=(45, 26, 75, 230), outline=(147, 51, 234, 180), width=1)
|
||
orig_text = farsi(f"ارزش واقعی پکیج: {original_price}")
|
||
f_orig = get_font(FONT_BOLD, 19)
|
||
draw.text(((rx1 + rx2)//2, ry2 - 50), orig_text, font=f_orig, fill='#E2E8F0', anchor='mm')
|
||
# Clean strike line
|
||
tw = draw.textlength(orig_text, font=f_orig)
|
||
tx = (rx1 + rx2)//2
|
||
draw.line([(tx - tw//2, ry2 - 50), (tx + tw//2, ry2 - 50)], fill=(239, 68, 68, 240), width=2)
|
||
|
||
# --- BOTTOM CTA BUTTON ---
|
||
btn_w = 660
|
||
btn_h = 100
|
||
bx1 = (W - btn_w)//2
|
||
by1 = 855
|
||
bx2 = bx1 + btn_w
|
||
by2 = by1 + btn_h
|
||
draw_pill_button(base, [bx1, by1, bx2, by2],
|
||
fill_grad_start=(245, 158, 11),
|
||
fill_grad_end=(251, 191, 36),
|
||
text=f"تخفیف ویژه اختصاصی: {price_text}",
|
||
subtext="ظرفیت محدود • فعالسازی آنی روی ایمیل شما",
|
||
text_color='#0B0F19')
|
||
|
||
# FOOTER CONTACT
|
||
f_footer = get_font(FONT_BOLD, 22)
|
||
draw.text((W // 2, 995), farsi("سفارش و مشاوره فوری: NetVibe_admin@ • کانال رسمی: NetVibe_VPN@"), font=f_footer, fill='#94A3B8', anchor='mm')
|
||
|
||
final_img = Image.new('RGB', (W, H), (10, 14, 26))
|
||
final_img.paste(base, (0, 0), base)
|
||
return final_img
|
||
|
||
# ==============================================================================
|
||
# 2. VPN SERVICE COMPARISON & PROMO BANNER (1080x1080)
|
||
# ==============================================================================
|
||
def render_vpn_banner(plan2_price="۳۰۰,۰۰۰ تومان", plan3_price="۳۵۰,۰۰۰ تومان"):
|
||
W, H = 1080, 1080
|
||
base = Image.new('RGBA', (W, H), (11, 15, 28, 255))
|
||
|
||
# Neon Cyan and Violet atmospheric glow
|
||
glow1 = create_radial_glow(W, H, 300, 480, 450, (6, 182, 212, 65)) # Cyan
|
||
glow2 = create_radial_glow(W, H, 780, 480, 450, (139, 92, 246, 75)) # Violet
|
||
glow3 = create_radial_glow(W, H, 540, 910, 380, (16, 185, 129, 50)) # Emerald
|
||
base.alpha_composite(glow1)
|
||
base.alpha_composite(glow2)
|
||
base.alpha_composite(glow3)
|
||
|
||
draw = ImageDraw.Draw(base)
|
||
|
||
# Top Category Pill
|
||
badge_w, badge_h = 420, 46
|
||
bx1, by1 = (W - badge_w)//2, 45
|
||
draw_rounded_glass_card(base, [bx1, by1, bx1 + badge_w, by1 + badge_h], (30, 41, 59, 180), (71, 85, 105, 160), radius=23, shadow=False)
|
||
draw_vector_shield(draw, (bx1 + 35, by1 + 23), 22, (6, 182, 212))
|
||
f_badge = get_font(FONT_BOLD, 21)
|
||
draw.text((W // 2 + 10, by1 + 23), farsi("سرویس اینترنت پرسرعت و پایدار NetVibe"), font=f_badge, fill='#38BDF8', anchor='mm')
|
||
|
||
# Main Headline
|
||
f_title = get_font(FONT_BOLD, 52)
|
||
f_sub = get_font(FONT_REGULAR, 24)
|
||
draw.text((W // 2, 132), farsi("اتصال پرسرعت، پایدار و بدون قطعی"), font=f_title, fill='#FFFFFF', anchor='mm')
|
||
draw.text((W // 2, 186), farsi("مناسب اینستاگرام، تلگرام، ترید، یوتیوب و وبگردی با پینگ فوقالعاده"), font=f_sub, fill='#94A3B8', anchor='mm')
|
||
|
||
# Card dimensions
|
||
card_w = 465
|
||
card_h = 590
|
||
card_top = 230
|
||
|
||
# --- LEFT CARD: PLAN 2-USER ---
|
||
lx1 = 55
|
||
lx2 = lx1 + card_w
|
||
ly1 = card_top
|
||
ly2 = ly1 + card_h
|
||
draw_rounded_glass_card(base, [lx1, ly1, lx2, ly2], (15, 23, 42, 230), (14, 165, 233, 200), radius=30)
|
||
|
||
# Shield Icon in Header
|
||
draw.rounded_rectangle([lx1 + 30, ly1 + 28, lx1 + 90, ly1 + 88], radius=18, fill=(12, 74, 110, 255), outline=(56, 189, 248, 180), width=1)
|
||
draw_vector_shield(draw, (lx1 + 60, ly1 + 58), 34, (56, 189, 248))
|
||
|
||
f_card_title = get_font(FONT_BOLD, 30)
|
||
f_tier = get_font(FONT_BOLD, 20)
|
||
f_item = get_font(FONT_REGULAR, 21)
|
||
|
||
draw.text((lx2 - 35, ly1 + 45), farsi("پلن ۲ کاربره نامحدود"), font=f_card_title, fill='#FFFFFF', anchor='rm')
|
||
draw.text((lx2 - 35, ly1 + 76), farsi("مناسب استفاده دو دستگاه همزمان"), font=f_tier, fill='#38BDF8', anchor='rm')
|
||
|
||
draw.line([(lx1 + 30, ly1 + 110), (lx2 - 30, ly1 + 110)], fill=(14, 116, 144, 180), width=1)
|
||
|
||
plan2_items = [
|
||
"حجم کاملاً نامحدود بدون سقف مصرف",
|
||
"سازگار با همراه اول، ایرانسل و وایفای",
|
||
"اتصال آنی و پایدار بدون افت سرعت",
|
||
"پینگ عالی و بدون قطعی در ساعات اوج",
|
||
"بدون نشت DNS و حفظ حریم خصوصی",
|
||
"پشتیبانی فعال ۲۴ ساعته تا انتهای اشتراک",
|
||
]
|
||
cur_y = ly1 + 155
|
||
for item in plan2_items:
|
||
draw_vector_check(draw, (lx2 - 25, cur_y), 24, (14, 165, 233), (255, 255, 255))
|
||
draw.text((lx2 - 50, cur_y), farsi(item), font=f_item, fill='#E2E8F0', anchor='rm')
|
||
cur_y += 58
|
||
|
||
# Price at bottom of Plan 2
|
||
draw.rounded_rectangle([lx1 + 35, ly2 - 75, lx2 - 35, ly2 - 25], radius=15, fill=(12, 74, 110, 230), outline=(56, 189, 248, 180), width=1)
|
||
draw.text(((lx1 + lx2)//2, ly2 - 50), farsi(f"ماهانه: {plan2_price}"), font=get_font(FONT_BOLD, 21), fill='#FFFFFF', anchor='mm')
|
||
|
||
# --- RIGHT CARD: PLAN 3-USER (FEATURED) ---
|
||
rx1 = W - 55 - card_w
|
||
rx2 = rx1 + card_w
|
||
ry1 = card_top
|
||
ry2 = ry1 + card_h
|
||
|
||
draw_rounded_glass_card(base, [rx1, ry1, rx2, ry2], (26, 19, 52, 240), (168, 85, 247, 230), radius=30)
|
||
draw.line([(rx1 + 30, ry1 + 2), (rx2 - 30, ry1 + 2)], fill=(245, 158, 11, 255), width=3)
|
||
|
||
# Lightning / Star in Header
|
||
draw.rounded_rectangle([rx1 + 30, ry1 + 28, rx1 + 90, ry1 + 88], radius=18, fill=(88, 28, 135, 255), outline=(216, 180, 254, 200), width=1)
|
||
draw_vector_lightning(draw, (rx1 + 60, ry1 + 58), 34, (245, 158, 11))
|
||
|
||
draw.text((rx2 - 35, ry1 + 45), farsi("پلن ۳ کاربره نامحدود"), font=f_card_title, fill='#FFFFFF', anchor='rm')
|
||
draw.text((rx2 - 35, ry1 + 76), farsi("⭐ پرفروشترین و اقتصادیترین پلن"), font=f_tier, fill='#F59E0B', anchor='rm')
|
||
|
||
draw.line([(rx1 + 30, ry1 + 110), (rx2 - 30, ry1 + 110)], fill=(107, 33, 168, 200), width=1)
|
||
|
||
plan3_items = [
|
||
"اتصال ۳ دستگاه همزمان با حجم نامحدود",
|
||
"سرورهای اختصاصی با بالاترین پهنای باند",
|
||
"بدون قطعی و افت سرعت در اینترنت ملی",
|
||
"سازگار با Android, iOS, Windows, Mac",
|
||
"آیپی ثابت مناسب ترید و بایننس",
|
||
"تضمین بازگشت وجه در صورت عدم رضایت",
|
||
]
|
||
cur_y = ry1 + 155
|
||
for item in plan3_items:
|
||
draw_vector_check(draw, (rx2 - 25, cur_y), 24, (168, 85, 247), (255, 255, 255))
|
||
draw.text((rx2 - 50, cur_y), farsi(item), font=f_item, fill='#F8FAFC', anchor='rm')
|
||
cur_y += 58
|
||
|
||
# Price at bottom of Plan 3
|
||
draw.rounded_rectangle([rx1 + 35, ry2 - 75, rx2 - 35, ry2 - 25], radius=15, fill=(76, 29, 149, 230), outline=(216, 180, 254, 200), width=1)
|
||
draw.text(((rx1 + rx2)//2, ry2 - 50), farsi(f"ماهانه: {plan3_price}"), font=get_font(FONT_BOLD, 21), fill='#FCD34D', anchor='mm')
|
||
|
||
# --- BOTTOM CTA BUTTON ---
|
||
btn_w = 660
|
||
btn_h = 100
|
||
bx1 = (W - btn_w)//2
|
||
by1 = 855
|
||
bx2 = bx1 + btn_w
|
||
by2 = by1 + btn_h
|
||
draw_pill_button(base, [bx1, by1, bx2, by2],
|
||
fill_grad_start=(16, 185, 129),
|
||
fill_grad_end=(52, 211, 153),
|
||
text="تحویل آنی و تست اتصال قبل از پرداخت",
|
||
subtext="پشتیبانی ۲۴ ساعته و کانفیگ رایگان تمام پلتفرمها",
|
||
text_color='#062D1F')
|
||
|
||
# FOOTER CONTACT
|
||
f_footer = get_font(FONT_BOLD, 22)
|
||
draw.text((W // 2, 995), farsi("ثبت سفارش و دریافت اکانت تست: NetVibe_admin@ • کانال: NetVibe_VPN@"), font=f_footer, fill='#94A3B8', anchor='mm')
|
||
|
||
final_img = Image.new('RGB', (W, H), (11, 15, 28))
|
||
final_img.paste(base, (0, 0), base)
|
||
return final_img
|
||
|
||
# Test both
|
||
im_gemini = render_gemini_banner("۶۰۰,۰۰۰ تومان", "۱,۵۰۰,۰۰۰ تومان")
|
||
im_gemini.save('/tmp/final_gemini_banner.png', quality=95)
|
||
|
||
im_vpn = render_vpn_banner("۳۰۰,۰۰۰ تومان", "۳۵۰,۰۰۰ تومان")
|
||
im_vpn.save('/tmp/final_vpn_banner.png', quality=95)
|
||
|
||
print("Rendered both final banners successfully!")
|