Skip to content

Latest commit

ย 

History

43 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation



๐ŸŽจ Pixel Art Studio

Create pixel art in your browser.

A full-featured pixel art editor with canvas rendering, color history, animation frames, and GIF export.


Live Demo โ€ข Features โ€ข Tech Stack โ€ข Quick Start โ€ข Usage โ€ข The process


๐Ÿ“– About

Pixel Art Studio is a browser-based pixel art editor built with React and Canvas API. It features a complete toolset including pen, eraser, flood fill, color history, animation frames, and GIF export. Built as a learning journey from vanilla JS to React.


๐ŸŽฏ Live Demo

Try it here!: https://pixel-art-maker-studio.vercel.app


๐ŸŽฅ Video Demo


๐ŸŽจ Drawing Tools

Feature Description
Pen Tool Click and drag to draw pixels
Eraser Tool Remove pixels with precision
Flood Fill Fill contiguous regions with one click
Eyedropper Tool Pick colors directly from the canvas

๐ŸŽจ Color System

Feature Description
8 Preset Colors Always available essential colors
8 Recent Colors Automatically tracks colors used on canvas
Custom Color Picker Choose any color with native picker
Smart History Colors added to history when actually used

๐Ÿ“ Grid System

Feature Description
Grid Sizes 16ร—16, 32ร—32, 64ร—64 options
Hover Preview See where you're about to paint
Drag Painting Click and drag for continuous drawing

๐ŸŽฌ Animation

Feature Description
Frame Management Save, load, delete frames
Play/Stop Animate through frames in sequence
GIF Export Export your animation as a GIF

๐Ÿ’พ Export Options

Feature Description
PNG Export Download your artwork as a PNG image
GIF Export Export animations as GIF (requires 2+ frames)
Smart Export Clean export without grid lines

โ†ฉ๏ธ Undo/Redo

Feature Description
Smart Batching Entire stroke grouped as one undo step
Keyboard Shortcuts Ctrl+Z / Ctrl+Y
Floating Buttons Always accessible over the canvas

๐Ÿ”Š Sound Effects

Feature Description
8-bit Sounds Retro sound effects for interactions
Throttled Drawing No sound spam during long drags
Game-like Feedback Click, paint, and success sounds

โŒจ๏ธ Keyboard Shortcuts

Shortcut Action
P Pen Tool
E Eraser Tool
F Fill Tool
I Eyedropper Tool
1-8 Select Preset Colors
Shift+1-8 Select More Colors
Ctrl+Z Undo
Ctrl+Y / Ctrl+Shift+Z Redo

๐Ÿ’พ Auto-save

Feature Description
localStorage Your artwork is saved automatically
Status Indicator Shows when your work is saved
Persistent Survives page refreshes and tab closures

๐Ÿ’ป Tech Stack

Frontend

โ”œโ”€โ”€ React 18
โ”œโ”€โ”€ Vite
โ”œโ”€โ”€ Canvas 2D API
โ”œโ”€โ”€ CSS3
โ””โ”€โ”€ Press Start 2P Font

Libraries

โ”œโ”€โ”€ gif.js (GIF Export)
โ”œโ”€โ”€ React Hooks
โ”œโ”€โ”€ Custom Hooks
โ””โ”€โ”€ Web Audio API (Sound Effects)

Features

โ”œโ”€โ”€ Canvas Rendering
โ”œโ”€โ”€ Flood Fill Algorithm
โ”œโ”€โ”€ Color History
โ”œโ”€โ”€ Animation Frames
โ”œโ”€โ”€ GIF Export
โ””โ”€โ”€ Auto-save

๐Ÿ“ Project Structure

pixel-art-studio/
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ components/
โ”‚ โ”‚ โ”œโ”€โ”€ Canvas.jsx # Canvas rendering + mouse events
โ”‚ โ”‚ โ”œโ”€โ”€ Toolbar.jsx # Tool selection (Pen, Eraser, Fill, Eyedropper)
โ”‚ โ”‚ โ”œโ”€โ”€ ColorPalette.jsx # Preset colors + History
โ”‚ โ”‚ โ”œโ”€โ”€ GridControls.jsx # Grid size selector
โ”‚ โ”‚ โ”œโ”€โ”€ UndoRedoButtons.jsx # Floating undo/redo + clear
โ”‚ โ”‚ โ””โ”€โ”€ Modal.jsx # Reusable confirmation modal
โ”‚ โ”œโ”€โ”€ hooks/
โ”‚ โ”‚ โ”œโ”€โ”€ usePixelArt.js # Main logic hook
โ”‚ โ”‚ โ””โ”€โ”€ useSound.js # 8-bit sound effects
โ”‚ โ”œโ”€โ”€ utils/
โ”‚ โ”‚ โ””โ”€โ”€ gifExporter.js # GIF export utility
โ”‚ โ”œโ”€โ”€ App.jsx
โ”‚ โ””โ”€โ”€ App.css
โ”œโ”€โ”€ public/
โ”‚ โ””โ”€โ”€ gif.worker.js # GIF.js worker script
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md


๐Ÿš€ Quick Start

1. Clone it

git clone https://github.com/chaima-sahli/pixel-art-studio.git
cd pixel-art-studio

2. Install dependencies

npm install

3. Start development server

npm run dev

๐ŸŽฎ Usage

  1. Select a tool - Pen (P), Eraser (E), Fill (F), or Eyedropper (I)
  2. Choose a color - Click preset colors, recent colors, or use the custom picker
  3. Draw - Click and drag on the canvas
  4. Add frames - Draw different frames and click โž• to save
  5. Export - Download as PNG or GIF animation
  6. Auto-save - Your work is automatically saved to localStorage

๐Ÿ‘ฉ๐Ÿฝโ€๐Ÿณ The Process

Built the vanilla JS version first to understand Canvas API basics. Then ported to React.

Step What I Did Why
1. Grid & Rendering 2D array with fillRect per cell Learned manual pixel manipulation
2. Mouse Events mousedown, mousemove, mouseup with coordinate mapping Understood event handling and coordinate systems
3. Flood Fill Iterative stack approach (recursion crashed on larger grids) Learned about algorithm optimization
4. React Migration Global vars โ†’ useState, render() โ†’ useEffect, UI โ†’ components Understood React's mental model
5. Polish Custom colors, grid sizing, PNG export Added user-friendly features

Why both versions? Building in vanilla JS first gave me a deep understanding of the Canvas API and DOM manipulation. Porting to React showed me how frameworks abstract away the complexity while adding structure and maintainability.


โœฆ Author โœฆ

Chaima Sahli

    โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—      โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
    โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•
    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•   โ–ˆโ–ˆโ•‘   
    โ–ˆโ–ˆโ•”โ•โ•โ•โ• โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ•โ•  โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•‘   
    โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘   
    โ•šโ•โ•     โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ•   โ•šโ•โ•   
    โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
      ๐ŸŽจ Create pixel art in your browser
    โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
   

About

Pixel art studio with canvas rendering, flood fill algorithm, undo/redo, animation frames, and GIF export. Built in vanilla JS, ported to React.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages