PIXEL_CANVAS

Date: 2025

Duration: 1 week

Role: Product Development and User Experience

Project Overview

The objective of this project was to develop a Flask-based web application that generates customizable pixel art canvases, powered by a PyTorch neural network (ColorNet) to create vibrant, dynamic color patterns. The app produces a retinal effect with colors clustered at the center, diffusing into a user-defined background (50% of pixels), and supports static PNG or animated GIF outputs.

Core Functionality

The app uses a PyTorch neural network (ColorNet) to generate vibrant RGB colors based on canvas coordinates, trained on synthetic data with Perlin noise (or a sinusoidal fallback) for dynamic patterns. Colors are clustered at the canvas center using Gaussian-weighted sampling, with 50% of pixels assigned a user-defined background color. Users can customize canvas size (10-1000 pixels), color mode (neural, random, predefined), contrast, clustering spread, and GIF animation speed through a web interface.

Web Interface

Built with Flask and Bootstrap 5, the interface organizes inputs into collapsible cards (Canvas, Color, Background, GIF, Advanced Settings) for clarity. It includes tooltips, form validation, flash messages for feedback, and a loading spinner during generation. JavaScript syncs the color picker with RGB inputs and toggles form sections dynamically.

Technical Components

Neural Network

A four-layer feedforward network predicts RGB values, trained with Adam optimization and MSE loss over 1000 epochs.

Color Clustering

NumPy implements Gaussian-weighted sampling for central color concentration.

GIF Generation

PIL creates animated GIFs with configurable frame duration (default 100ms) and frame count (default 20).