Skip to content

Pascal-Institute/pegasus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

DeepWiki

Pegasus

Give wings to pixels ๐Ÿชฝ

A powerful image processing and analysis tool built with Electron and Sharp, featuring an intuitive multi-panel interface for batch image operations.

image

๐Ÿ“‹ Table of Contents


โœจ Features

๐Ÿ–ผ๏ธ Multi-Panel Interface

  • Horizontal scrollable image panels for easy navigation
  • Multi-select support: Select multiple images using Ctrl + Click
  • Batch operations: Apply transformations to multiple images at once
  • Drag & drop: Load images directly into panels
  • Live preview: See changes in real-time

๐ŸŽจ Image Processing

  • Resize: Scale images by percentage or pixel width
  • Crop: Interactive cropping with visual feedback
  • Rotate: Arbitrary angles or quick 90ยฐ rotations
  • Flip/Flop: Mirror images horizontally or vertically
  • Filters: Blur, sharpen, median, dilate, erode, normalize
  • Color: Grayscale, negative, tint, threshold
  • Watermark: Composite images with transparency
  • Paint: Draw directly on images with adjustable brush

๐ŸŽฌ Advanced Features

  • Animated GIF support with playback controls
  • Color picker: Extract colors from images
  • Undo/Redo: Full history for each image layer
  • Format conversion: Convert between 13+ image formats
  • Keyboard shortcuts: Fast workflow with hotkeys

๐Ÿ“ฆ Requirements

For Development

  • Node.js: v22.18.0 or higher
  • IDE: Visual Studio Code (recommended)
  • Platform: Windows, macOS, or Linux

For End Users

  • Download and install Pegasus Setup.exe from releases
  • No additional dependencies required

๐Ÿš€ Installation

Development Setup

  1. Clone the repository
git clone https://github.com/Pascal-Institute/pegasus.git
cd pegasus
  1. Install dependencies
npm install
  1. Rebuild native modules
npm run rebuild

User Installation

Simply download and run the installer for your platform from the Releases page.


๐Ÿ’ป Development

Run in Development Mode

Windows:

npm start

Linux:

electron . --ozone-platform=x11

Build for Production

npm run build

This creates installers in the output/ directory.

Build for Windows Store

npm run build:win-store

๐Ÿ“ Project Structure

pegasus/
โ”œโ”€โ”€ core/                   # Core image rendering engine
โ”‚   โ”œโ”€โ”€ image_renderer.js   # Main UI renderer and panel manager
โ”‚   โ”œโ”€โ”€ image_layer.js      # Individual image panel component
โ”‚   โ””โ”€โ”€ pix.js              # Custom .pix format handler
โ”‚
โ”œโ”€โ”€ features/               # Feature modules
โ”‚   โ”œโ”€โ”€ image_mode.js       # Interaction mode system (crop, draw, etc.)
โ”‚   โ”œโ”€โ”€ image_layer_events.js  # Event handlers for panels
โ”‚   โ”œโ”€โ”€ layer_history.js    # Undo/redo implementation
โ”‚   โ””โ”€โ”€ gif_animation.js    # Animated GIF playback
โ”‚
โ”œโ”€โ”€ processing/             # Image processing logic
โ”‚   โ”œโ”€โ”€ image_processor.js  # Main processing operations
โ”‚   โ”œโ”€โ”€ image_loader.js     # File loading and validation
โ”‚   โ””โ”€โ”€ format_converter.js # Format conversion utilities
โ”‚
โ”œโ”€โ”€ renderer/               # UI renderers for each panel
โ”‚   โ”œโ”€โ”€ main_renderer.js    # Main application renderer
โ”‚   โ”œโ”€โ”€ resize_renderer.js
โ”‚   โ”œโ”€โ”€ crop_renderer.js
โ”‚   โ”œโ”€โ”€ filter_renderer.js
โ”‚   โ”œโ”€โ”€ rotate_renderer.js
โ”‚   โ”œโ”€โ”€ paint_renderer.js
โ”‚   โ””โ”€โ”€ image_analysis_renderer.js
โ”‚
โ”œโ”€โ”€ pages/                  # HTML panel templates
โ”œโ”€โ”€ css/                    # Stylesheets
โ”œโ”€โ”€ components/             # Reusable UI components
โ”œโ”€โ”€ utils/                  # Utility functions
โ”‚   โ”œโ”€โ”€ ipc_bridge.js       # IPC communication bridge
โ”‚   โ””โ”€โ”€ ui_loader.js        # Dynamic UI component loader
โ”‚
โ”œโ”€โ”€ main.js                 # Electron main process
โ”œโ”€โ”€ image_kit.js            # Public API exports
โ””โ”€โ”€ index.html              # Main application window

Key Modules

Core Module

  • ImgKitRenderer: Manages the scrollable container and image panels
  • ImageLayer: Represents each individual image with canvas and controls

Features Module

  • ImageMode: Defines interaction modes (NORMAL, CROPPING, DRAWING, etc.)
  • ModeManager: Handles mode transitions for each layer
  • LayerHistory: Implements undo/redo stack
  • GifAnimation: Controls animated GIF playback

Processing Module

  • ImageProcessor: Pure image processing functions using Sharp
  • ImageLoader: Handles file I/O and format validation
  • FormatConverter: Converts between different image formats

๐ŸŽฎ Usage

Basic Workflow

  1. Load Images: Drag & drop or use File > Open
  2. Select Tool: Click tool buttons (Resize, Crop, Filter, etc.)
  3. Apply Operation: Adjust parameters in the panel
  4. Save: File > Save or Save As

Keyboard Shortcuts

Shortcut Action
Ctrl + A Select all images
Ctrl + Z Undo
Ctrl + Y Redo
Alt + M Toggle magnifying glass
Alt + H Hide current layer
F11 Toggle fullscreen

Multi-Select

  • Select: Click on an image panel
  • Add to selection: Ctrl + Click
  • Deselect: Ctrl + Click on selected panel
  • Visual Feedback: Selected panels show green border

๐Ÿ–ผ๏ธ Supported Formats

Input/Output Formats

png, jpg, jpeg, webp, gif, bmp, ico, tiff, tif, svg, avif, heif, heic, pix

Special Features

  • โœ… Animated GIF: Full playback controls (play, pause, frame navigation)
  • โœ… PIX format: Custom format for lossless editing
  • โœ… ICC profiles: Preserved during conversion
  • โœ… EXIF data: Metadata preservation

See GIF Animation Documentation for animated GIF details.


๐Ÿ—๏ธ Architecture

Electron Process Model

Main Process (main.js)
    โ”œโ”€โ”€ Creates BrowserWindow
    โ”œโ”€โ”€ Handles file dialogs
    โ”œโ”€โ”€ Manages IPC communication
    โ””โ”€โ”€ Coordinates processing operations

Renderer Process (index.html)
    โ”œโ”€โ”€ UI Components (components/)
    โ”œโ”€โ”€ Image Panels (core/image_layer.js)
    โ”œโ”€โ”€ Event Handlers (features/image_layer_events.js)
    โ””โ”€โ”€ Tool Panels (renderer/*.js)

Processing Worker
    โ””โ”€โ”€ Sharp-based image operations (processing/)

Data Flow

User Action โ†’ Renderer โ†’ IPC โ†’ Main Process โ†’ ImageProcessor โ†’ Sharp โ†’ Result
                โ†‘                                                        โ†“
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ IPC Response โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Module Dependencies

image_kit.js (Entry Point)
    โ”œโ”€โ”€ core/image_renderer.js
    โ”‚   โ”œโ”€โ”€ core/image_layer.js
    โ”‚   โ”‚   โ”œโ”€โ”€ features/image_layer_events.js
    โ”‚   โ”‚   โ”œโ”€โ”€ features/layer_history.js
    โ”‚   โ”‚   โ”œโ”€โ”€ features/gif_animation.js
    โ”‚   โ”‚   โ”œโ”€โ”€ processing/image_processor.js
    โ”‚   โ”‚   โ””โ”€โ”€ processing/image_loader.js
    โ”‚   โ””โ”€โ”€ features/image_mode.js
    โ”œโ”€โ”€ processing/image_processor.js
    โ”‚   โ””โ”€โ”€ processing/format_converter.js
    โ””โ”€โ”€ features/image_mode.js

๐Ÿ› ๏ธ Coding Conventions

  • File naming: Use underscores (resize_panel.js)
  • Classes: PascalCase (ImageProcessor)
  • Functions: camelCase (processImage)
  • Constants: UPPER_SNAKE_CASE (LAYER_EVENT_CHANNEL)

๐Ÿ“š Documentation


๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Follow the coding conventions
  4. Submit a pull request

๐Ÿ“„ License

See LICENSE file for details.


๐Ÿ™ Acknowledgments

Built with:


Made with โค๏ธ by Pascal Institute