How 00danii/nebula works
1. Purpose and shape of the system
Nébula is a desktop image editor written in Python, centered on applying “scientific/astronomical” visual treatments to a single image. The repository is organized around a Tkinter UI, an image-processing engine, separate creative-style and metadata-style pipelines, and a canvas-based preview/export flow.
2. Application bootstrap and runtime entrypoints
main.py is the normal entrypoint for development runs. ui/app.py likely constructs the main window and wires the rest of the application together. The repo also includes Nebula.spec, build/, dist/, scripts/build_exe.bat, and ejecutar.bat, which show the project is packaged as a standalone Windows executable with PyInstaller.
3. UI layer as the interaction boundary
The ui/ package is the presentation layer: app.py for the main window, canvas.py for preview rendering, controls.py for the adjustment panels, and theme.py for the dark UI styling. This layer owns user interaction, keyboard shortcuts, fullscreen behavior, and the visible state of sliders, comboboxes, and color pickers.
4. Core processing pipeline
The core/ package is the main application logic. engine.py is the orchestration boundary between UI and processing. image_processor.py is where image transformations are applied. grid_renderer.py and metadata_renderer.py are responsible for overlay generation. data_generator.py likely computes the synthetic scientific measurements and labels used by metadata overlays.
5. Data flow from user action to preview
The typical flow is: the user opens an image in the UI, the engine stores it as the current working image, style settings are adjusted through controls, and the engine re-runs the processing pipeline to produce a preview. The rendered result is then drawn onto the canvas. Saving uses the same processed output path, but writes to file instead of the on-screen canvas.
6. Creative style subsystem
The styles/ package contains the major visual effects applied to the image itself. base_style.py defines the shared style contract, style_manager.py selects and configures styles, and the concrete style modules implement effects such as sepia, CRT, thermal, noir, neon, duotone, tritone, invert, custom, and alien signal. This is a self-contained transformation layer that can be composed with basic adjustments like brightness, gamma, temperature, and saturation.
7. Metadata overlay subsystem
The metadata_styles/ package is separate from the creative image filters. It contains base_metadata_style.py, manager.py, and concrete overlay styles such as alien HUD, minimal, scientific HUD, astronomical plate, and geometric. These styles draw the simulated instrument readouts, labels, coordinates, bars, and technical annotations that make the output look like a scientific plate rather than just a filtered photo.
8. Overlay and framing logic
The grid and metadata layers are distinct from the core image effects. core/grid_renderer.py adds telescope-like grid elements, axes, ticks, cardinal directions, and legends. The metadata styles add their own annotations and coordinate readouts. This creates a layered composition: original image → creative filter → scientific grid → metadata overlay.
9. Shared utilities and resources
utils/font_utils.py provides font handling for the rendered overlays and UI text, which matters because the output relies on precise technical-looking typography. utils/__init__.py contains resource-path handling so assets resolve correctly both in source runs and in the PyInstaller executable. The assets/ folder stores the logo and example renders used by the app and README.
10. State management and architectural boundaries
The README explicitly calls out an Observer pattern between UI and engine, which suggests the UI does not directly manipulate rendering internals but publishes control changes to the engine. It also notes Singleton-style managers for fonts and styles, implying centralized registry objects for reusable rendering resources and style selection. These boundaries keep presentation, processing, and style configuration separated.
11. Input/output characteristics
The app is image-file oriented rather than batch-oriented or network-oriented. It loads PNG, JPG/JPEG, BMP, and TIFF, and exports PNG or JPG. The processing stack depends on OpenCV, NumPy, and Pillow, which indicates pixel-level transformations, color-space conversions, image compositing, and blur/colormap operations are core to the design.
12. What to emphasize in an architecture diagram
The most important boxes are: UI shell, engine/orchestrator, image processor, creative styles, metadata styles, grid renderer, and output canvas/export. The key arrows are user events into UI, UI state changes into engine, engine into processing/rendering modules, and processed image back to canvas/save. The packaging/build files are peripheral support, not part of runtime flow, but they matter if the diagram includes deployment.
Main entry points: engine.py Engine · app.py App · style_manager.py Style mgr · manager.py Meta mgr
Components 20
Runtime
Application entrypoints and execution flow
- Main · Development entrypoint that starts the desktop app
main.py
UI
Tkinter presentation layer and interaction boundary
Core
Image orchestration, processing, and overlays
- Engine · Coordinates UI events, state, processing, preview, and export
core/engine.py - Processor · Applies image transformations and compositing steps
core/image_processor.py - Grid · Draws telescope-like grid, axes, ticks, and legends
core/grid_renderer.py - Metadata · Renders metadata annotations and plate-style overlays
core/metadata_renderer.py - Data gen · Generates synthetic scientific values and labels for overlays
core/data_generator.py
Creative styles
Image effect pipeline and style selection
- Style mgr · Selects and configures creative image styles
styles/style_manager.py - Style base · Shared interface for creative image effects
styles/base_style.py - Creative styles · Collection of concrete image effects such as sepia, CRT, thermal, and noir
styles/creative_styles.py
Metadata styles
Scientific overlay templates and metadata rendering
Support
Shared utilities, assets, and packaging
- Fonts · Handles font loading and text rendering consistency
utils/font_utils.py - Paths · Resolves resource paths for source runs and packaged executables
utils/__init__.py - Assets · Logo and example renders used by the app and documentation
assets - PyInstaller · Executable packaging and Windows build artifacts
Nebula.spec
Connections 21
- Main → App: starts · Launches the main application window
- App → Controls: hosts · Creates and wires the control panels
- App → Canvas: drives · Connects preview rendering to the main window
- App → Theme: applies · Uses shared UI styling
- Controls → Engine: events · Publishes user adjustments to the orchestrator
- Canvas → Engine: requests · Receives processed frames from engine state changes
- Engine → Processor: runs · Invokes the image transformation pipeline
- Engine → Grid: adds · Overlays grid and framing elements
- Engine → Metadata: adds · Composites metadata overlays onto the image
- Engine → Style mgr: selects · Chooses the active creative style
- Style mgr → Style base: implements · Uses the shared style contract
- Style mgr → Creative styles: loads · Instantiates concrete visual effects
- Engine → Meta mgr: selects · Chooses the active metadata style
- Meta mgr → Meta base: implements · Uses the shared metadata contract
- Meta mgr → Overlay styles: loads · Instantiates concrete overlay styles
- Metadata → Data gen: feeds · Consumes generated values for annotations and labels
- Processor → Fonts: uses · Depends on font handling for overlays and text
- App → Fonts: uses · Uses font utilities for interface text consistency
- Paths → Assets: resolves · Helps locate bundled resources and example media
- PyInstaller → Assets: packages · Bundles resources into the standalone executable
- PyInstaller → App: ships · Packages the desktop application entry path