Back to Portfolio

Sections

Case Studies

Card Graphics API

FlaskREST APIPIL/Pillow

A sophisticated Flask-based microservice that generates dynamic Discord visuals including user profile cards, server leaderboards, and comprehensive statistics dashboards with advanced image processing capabilities.

Project Overview

Problem Statement
  • Flask-based REST API with three main endpoints
  • PIL/Pillow for advanced image processing
  • Dynamic avatar and banner integration
  • Custom font rendering and text positioning
  • Automated Git deployment endpoint
Solution Impact
  • User profile cards with statistics
  • Server leaderboards (messages & voice)
  • Server analytics dashboards
  • Badge and emoji integration
  • Responsive image layouts

API Endpoints

POST /profile
Generates comprehensive user profile cards

Creates detailed profile images with user statistics, top servers, friends, tracks, playlists, and custom badges with circular avatar cropping and dynamic text positioning. Supports multiple data sources including music ranks, listening time, server statistics, and user achievements.

POST /leaderboard
Creates server leaderboards for messages and voice activity

Generates paginated leaderboards with server branding, user avatars, and statistics. Supports both message and voice activity tracking with custom date ranges. Features responsive layout with guild icons, banners, and customizable modes for users or channels.

POST /server_top
Produces comprehensive server analytics dashboards

Creates detailed server overview images with daily statistics, top contributors, and channel analytics with customizable lookback periods and timezone support. Displays message trends, voice activity, top members across text and voice channels with comprehensive data visualization.

Technical Implementation

Performance Features

Memory Optimization: BytesIO streams for efficient image handling

Error Handling: Fallback avatars and graceful degradation

Text Truncation: Smart text fitting with ellipsis for long names

Format Conversion: Automatic image format standardization

Image Processing

PIL/Pillow Integration: Advanced image manipulation with custom fonts, gradients, and effects

Dynamic Layouts: Responsive positioning based on content length and user data

Avatar Processing: Circular cropping, resizing, and transparency handling

Background Effects: Gaussian blur, brightness adjustment, and overlay masking

Impact & Results

3
Core API Endpoints
1280x720
High-Quality Images
Real-time
Image Generation

Technologies Used

Python
Flask Framework
PIL/Pillow
REST API
Discord.py
Image Processing
BytesIO Optimization
Git Automation
Linux Deployment