Skip to content

G3rarrd/NPRStudio

Repository files navigation

πŸ–₯️ NPR Studio

NPR Studio is a WebGL-powered application that allows users to stylize images using ausing a wide range of Non-Photorealistic Rendering (NPR) techniques. It includes advanced filters such as eXtended Difference of Gaussians (XDoG), Anisotropic Kuwahara Filtering, Flow-Based Bilateral Filtering, and many more. Explore and expreiment different artistic effects directly in the browser

Table of Contents

Features

Image Processing Stylizations

…and more GPU-based shader effects.

Editing Tools

  • Zoom (mouse wheel, shortcuts, UI)
  • Pan (drag or shift+wheel)
  • Fit to Screen / Reset View
  • Undo & Redo (WebGL framebuffer history stack)
  • Real-time slider controls for all filter parameters

File Management

  • Drag-and-drop image uploading
  • Export processed result as the initial uploaded format

back to top

Tech Stack

Frontend

  • React (State management and context provider)
  • TypeScript
  • CSS Modules

Rendering & Image Processing

  • WebGL2 – GPU-accelerated 2D/3D rendering
  • GLSL – Shader programming language for image effects

Build & Tooling

  • Vite
  • NPM

back to top

Gallery

Original XDoG Filter
Alt text Alt text
Original Anisotropic Kuwahara Filter
Alt text Alt text
Original Coherent Line Drawing (CLD) Filter
Alt text Alt text

Getting Started

1. Clone the repository

git clone https://github.com/G3rarrd/NPRStudio

2. Install dependencies

npm install

3. Start the development server

npm run dev

4. Build for production

npm run build

**5. Preview Production

Install serve if you don’t have it

npm install -g serve

Then run to preview the application locally

serve -s dist

back to top

Usage

1. Upload an Image

  • Drag and drop an image onto an upload area, or click the upload area to select a file at the start of the application
  • Supported formats: PNG, JPEG, JPG.

2. Apply Filters

  • Select the filter options on the menu bar to add an effect to your image
  • Adjust filter sliders (some don't have) based on your preference.

3. Navigate the Canvas

  • Zoom – alt + mouseWheel
  • Pan – Hold down the mouse wheel on the canvas
  • Fit to Screen / Reset View – Use view buttons in the menu bar

4. Undo / Redo

  • Undo - ctrl+z
  • Redo - ctrl+shift+z

5. Import / Export

  • Click the File button in the menu bar and select Export to download the file or Open to load a new image back to top

Project Structure

β”œβ”€β”€ App.css  
β”œβ”€β”€ App.tsx  
β”œβ”€β”€ assets/                     # Icons, logos  
β”œβ”€β”€ features/
β”‚   └── image_processing/       # Main image processing editor
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ image_processing_context/ # Context manager of the editor
β”‚       β”‚   β”‚   β”œβ”€β”€ image_processing_context.tsx
β”‚       β”‚   β”‚   └── image_processing_provider.tsx
β”‚       β”‚   └── image_processing_upload/ # image drag-and-drop + file handling.
β”‚       β”‚       β”œβ”€β”€ components/
β”‚       β”‚       β”‚   └── image_processing_upload_area/
β”‚       β”‚       β”œβ”€β”€ image_processing_upload_area.css
β”‚       β”‚       └── image_processing_upload_area.tsx
β”‚       β”œβ”€β”€ image_processing_canvas/ # Canvas using WebGL2 API
β”‚       β”‚   β”œβ”€β”€ hooks/
β”‚       β”‚   β”‚   └── useWebGL2DCamera.ts # handles zoom and pan done on the canvas
β”‚       β”‚   β”œβ”€β”€ image_processing_canvas.css
β”‚       β”‚   └── image_processing_canvas.tsx
β”‚       β”œβ”€β”€ image_processing_index.css
β”‚       β”œβ”€β”€ image_processing_index.tsx
β”‚       β”œβ”€β”€ image_processing_menu_bar/
β”‚       β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”‚   β”œβ”€β”€ image_processing_create_new_btn/
β”‚       β”‚   β”‚   β”œβ”€β”€ image_processing_edit_btn/
β”‚       β”‚   β”‚   β”œβ”€β”€ image_processing_file_btn/
β”‚       β”‚   β”‚   β”œβ”€β”€ image_processing_filter_btn/
β”‚       β”‚   β”‚   β”œβ”€β”€ image_processing_home_btn/
β”‚       β”‚   β”‚   └── image_processing_view_btn/
β”‚       β”‚   β”œβ”€β”€ image_processing_menu_bar.module.css
β”‚       β”‚   └── image_processing_menu_bar.tsx
β”‚       └── image_processing_tool_bar/
β”‚           └── components/
β”œβ”€β”€ hooks/
β”‚   └── useUpload.ts
β”œβ”€β”€ index.css
β”œβ”€β”€ layouts/
β”‚   └── image_processing_layout/
β”‚       β”œβ”€β”€ hooks/
β”‚       β”œβ”€β”€ image_processing_page_layout.module.css
β”‚       └── image_processing_page_layout.tsx
β”œβ”€β”€ main.tsx
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ homes.tsx
β”‚   β”œβ”€β”€ noPage.tsx
β”‚   └── studio.tsx
β”œβ”€β”€ services/
β”œβ”€β”€ types/
β”‚   └── slider.ts
β”œβ”€β”€ engine/ # Image Processing Engine (Core of the application)
β”‚   β”œβ”€β”€ Scene/ # Displays image on the canvas (rendering orchestrator)
β”‚   β”œβ”€β”€ ShaderCodes/ # Contains shader codes of composite and non composite styles
β”‚   β”œβ”€β”€ framebuffer_textures/ # Creation and management of framebuffers and textures
β”‚   β”œβ”€β”€ math/
β”‚   β”œβ”€β”€ random.ts
β”‚   β”œβ”€β”€ webGLCore.ts
β”‚   β”œβ”€β”€ webGLImageExporter.ts
β”‚   └── webGLToneMapping.ts
└── vite-env.d.ts

back to top

Future Directions

  • Implementation of a node editor that allows the combination of multiple stylizations. Possible libraries include (Rete.js, React Flow, and LiteGraph.js)
  • Addition of other Non-Photorealistic Rendering Techniques

back to top

Contributing

Contributions are welcomed! Please feel free to submit pull requests, report bugs, or suggest new features.

back to top

About

NPR Studio is a WebGL-powered web solution for stylizing images with traditional Non-Photorealistic Rendering techniques.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages