# lord-samuel/pixcore architecture

> Architecture diagram of the GitHub repository lord-samuel/pixcore, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lord-samuel/pixcore
- Repository: https://github.com/lord-samuel/pixcore

## Overview

pixcore is a chainable Node.js image-processing and canvas library. Its main workflow is to read and decode an image into a PixCore instance, apply pixel transforms, then encode a buffer; optional branches handle animated WebP frames and sticker EXIF metadata. Canvas drawing is a separate creation path that uses color parsing, rasterization, font/emoji rendering, and can produce an image for the same processing and encoding API. Relationships are limited to calls shown in excerpts or capabilities explicitly described in the README; unsampled internals are not inferred.

Main entry points: [`index.js`](https://github.com/lord-samuel/pixcore/blob/main/index.js) (PixCore API), [`src/canvas.js`](https://github.com/lord-samuel/pixcore/blob/main/src/canvas.js) (Canvas API), [`src/decode.js`](https://github.com/lord-samuel/pixcore/blob/main/src/decode.js) (Image Decode), [`src/encode.js`](https://github.com/lord-samuel/pixcore/blob/main/src/encode.js) (Image Encode)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_image_io["Image I/O"]
  node_pixcore_api["PixCore API<br/>[index.js]"]
  node_image_decode["Image Decode<br/>[decode.js]"]
  node_image_encode["Image Encode<br/>[encode.js]"]
end

subgraph group_processing["Image Processing"]
  node_pixel_ops["Pixel Operations<br/>[ops.js]"]
end

subgraph group_animation_stickers["Animation &amp; Stickers"]
  node_animation["Animated WebP<br/>[animated.js]"]
  node_sticker_exif["Sticker EXIF<br/>[exif.js]"]
end

subgraph group_canvas_rendering["Canvas Rendering"]
  node_canvas_api["Canvas API<br/>[canvas.js]"]
  node_color_parser["Color Parser<br/>[color.js]"]
  node_rasterizer["Rasterizer<br/>[raster.js]"]
  node_emoji_font["Emoji Fonts<br/>[emoji.js]"]
end

node_user(("Library User"))

node_user -->|"uses"| node_pixcore_api
node_pixcore_api -->|"decodes input"| node_image_decode
node_pixcore_api -->|"applies transforms"| node_pixel_ops
node_pixcore_api -->|"encodes output"| node_image_encode
node_pixcore_api -->|"adds metadata"| node_sticker_exif
node_image_decode -->|"decodes frames"| node_animation
node_image_encode -->|"builds animation"| node_animation
node_pixcore_api -->|"creates canvas"| node_canvas_api
node_canvas_api -->|"parses colors"| node_color_parser
node_canvas_api -->|"rasterizes shapes"| node_rasterizer
node_canvas_api -->|"loads emoji"| node_emoji_font
node_canvas_api -->|"resizes glyphs"| node_pixel_ops
node_canvas_api -->|"decodes glyphs"| node_image_decode

click node_pixcore_api "https://github.com/lord-samuel/pixcore/blob/main/index.js"
click node_image_decode "https://github.com/lord-samuel/pixcore/blob/main/src/decode.js"
click node_image_encode "https://github.com/lord-samuel/pixcore/blob/main/src/encode.js"
click node_pixel_ops "https://github.com/lord-samuel/pixcore/blob/main/src/ops.js"
click node_animation "https://github.com/lord-samuel/pixcore/blob/main/src/animated.js"
click node_sticker_exif "https://github.com/lord-samuel/pixcore/blob/main/src/exif.js"
click node_canvas_api "https://github.com/lord-samuel/pixcore/blob/main/src/canvas.js"
click node_color_parser "https://github.com/lord-samuel/pixcore/blob/main/src/color.js"
click node_rasterizer "https://github.com/lord-samuel/pixcore/blob/main/src/raster.js"
click node_emoji_font "https://github.com/lord-samuel/pixcore/blob/main/src/emoji.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pixcore_api,node_image_decode,node_image_encode,node_user toneBlue
class node_pixel_ops toneAmber
class node_animation,node_sticker_exif toneMint
class node_canvas_api,node_color_parser,node_rasterizer,node_emoji_font toneRose
```

## Components

### Image I/O

- [PixCore API](https://github.com/lord-samuel/pixcore/blob/main/index.js): `index.js`
- [Image Decode](https://github.com/lord-samuel/pixcore/blob/main/src/decode.js): `src/decode.js`
- [Image Encode](https://github.com/lord-samuel/pixcore/blob/main/src/encode.js): `src/encode.js`

### Image Processing

- [Pixel Operations](https://github.com/lord-samuel/pixcore/blob/main/src/ops.js): `src/ops.js`

### Animation & Stickers

- [Animated WebP](https://github.com/lord-samuel/pixcore/blob/main/src/animated.js): `src/animated.js`
- [Sticker EXIF](https://github.com/lord-samuel/pixcore/blob/main/src/exif.js): `src/exif.js`

### Canvas Rendering

- [Canvas API](https://github.com/lord-samuel/pixcore/blob/main/src/canvas.js): `src/canvas.js`
- [Color Parser](https://github.com/lord-samuel/pixcore/blob/main/src/color.js): `src/color.js`
- [Rasterizer](https://github.com/lord-samuel/pixcore/blob/main/src/raster.js): `src/raster.js`
- [Emoji Fonts](https://github.com/lord-samuel/pixcore/blob/main/src/emoji.js): `src/emoji.js`

### Other components

- **Library User**

## Connections

- Library User → PixCore API: uses (evidence: `README.md`)
- PixCore API → Image Decode: decodes input (evidence: `index.js`)
- PixCore API → Pixel Operations: applies transforms (evidence: `index.js`)
- PixCore API → Image Encode: encodes output (evidence: `index.js`)
- PixCore API → Sticker EXIF: adds metadata (evidence: `index.js`)
- Image Decode → Animated WebP: decodes frames (evidence: `src/decode.js`)
- Image Encode → Animated WebP: builds animation (evidence: `src/encode.js`)
- PixCore API → Canvas API: creates canvas (evidence: `index.js`)
- Canvas API → Color Parser: parses colors (evidence: `src/canvas.js`)
- Canvas API → Rasterizer: rasterizes shapes (evidence: `src/canvas.js`)
- Canvas API → Emoji Fonts: loads emoji (evidence: `src/canvas.js`)
- Canvas API → Pixel Operations: resizes glyphs (evidence: `src/canvas.js`)
- Canvas API → Image Decode: decodes glyphs (evidence: `src/canvas.js`)
