DEV Community

Cover image for HakoNyans: A Transparent Lossless Codec Challenge (with GitHub Copilot CLI)
CharmPic
CharmPic

Posted on

HakoNyans: A Transparent Lossless Codec Challenge (with GitHub Copilot CLI)

GitHub Copilot CLI Challenge Submission

This is a submission for the GitHub Copilot CLI Challenge

## What I Built

I built HakoNyans, an experimental image codec focused on practical decode speed and transparent lossless results
across different image types (photo, anime, UI/screen).

For this challenge, I focused on two things:

  1. A clearer lossless workflow in CLI
  2. Added a new command:
  3. hakonyans encode-lossless <in.ppm> <out.hkn> [preset: fast|balanced|max]
  4. This makes lossless testing reproducible from the terminal without custom scripts.

  5. Reproducible visual and metric snapshots

  6. Prepared a dedicated asset pack for challenge demos:

  7. docs/assets/devchallenge_2026_01_21/

  8. Included side-by-side comparisons and both win and lose cases (to keep reporting honest).

What this project means to me:

  • I wanted to show not just “best-case screenshots,” but a realistic engineering snapshot:
  • where HKN already wins (some natural-photo cases), and where PNG is still much stronger (some structured/UI-like cases).

## Demo

### Screenshots

Main comparison
Artoria side-by-side compare

Main comparison metrics (Artoria, lossless)

  • Source PNG (Artoria): 17,669,320 bytes
  • Env: HAKONYANS_THREADS=1
  • Command: ./build/hakonyans encode-lossless <in.ppm> <out.hkn> <preset>
  • Encode time: 2-run median wall time

| Preset | HKN bytes | PNG bytes | PNG/HKN | Encode time |
| balanced | 17,374,550 | 17,669,320 | 1.0170 | 2.94 s |
| max | 16,767,516 | 17,669,320 | 1.0538 | 101.18 s |

PNG/HKN > 1.0 means HKN is smaller.

Lossless win case (nature_01)
Lossless win case

Lossless lose case (hd_01)
Lossless lose case

### Example metrics snapshot (fixed6, max preset)

  • nature_01: HKN 812,567 bytes vs PNG 1,281,481 bytes (PNG/HKN = 1.577)
  • nature_02: HKN 999,685 bytes vs PNG 1,446,470 bytes (PNG/HKN = 1.447)
  • hd_01: HKN 699,858 bytes vs PNG 8,785 bytes (PNG/HKN = 0.0126)

So currently:

  • HKN can beat PNG on some photo-like content.
  • PNG still dominates some structured/worst-case images.
  • The project is actively improving both sides.

## My Experience with GitHub Copilot CLI

GitHub Copilot CLI was most useful for my fast implementation loop:

  • Refactoring large headers into smaller units safely
  • Adding a new CLI command (encode-lossless) while preserving existing behavior
  • Running repetitive verify loops quickly (build, ctest, benchmark checks)
  • Generating and validating challenge-ready visual assets from command pipelines

The biggest impact was speed + consistency.
I could iterate quickly in terminal-first workflows while keeping changes verifiable (tests, checksums, RMSE checks,
benchmark CSVs).

Top comments (1)

Collapse
 
charmpic profile image
CharmPic •

Development continues even after the challenge ends.

We beat PNG!
We're still losing to webp.

Webp is strong!