# Decoding REXPaint Files in Odin: A Gentle Intro to Binary Formats

> Hacker News story 50436363 · language: en · submitted 2026-11-10
> Web version: https://zeli.app/story/50436363
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 22 · by [tylerelton](<https://news.ycombinator.com/user?id=tylerelton>) · 💬 2
[original](<https://tylerelton.com/posts/decoding-rexpaint-files-in-odin/>) · [HN discussion](<https://news.ycombinator.com/item?id=50436363>)

## Summary

REXPaint, the ASCII art tool behind Cogmind, stores its .xp files as gzipped binary with a simple layout: a version integer, a layer count, then per-layer dimensions and 10-byte cells in column-major order. Using Odin, the post builds a small cursor-based reader, handles errors with a custom union, and shows how to validate untrusted counts before allocating memory.

## Key quote

> The first two bytes, 1f8b, are the magic number, a fixed byte sequence that identifies a file’s format.

---

## Cite

- Page: https://zeli.app/story/50436363
- Date: 2026-11-10
- Source: tylerelton.com (https://tylerelton.com/posts/decoding-rexpaint-files-in-odin/)
- Hacker News: https://news.ycombinator.com/item?id=50436363

## Other languages

- zh: https://zeli.app/zh/story/50436363 · markdown: https://zeli.app/zh/story/50436363.md
- ja: https://zeli.app/ja/story/50436363 · markdown: https://zeli.app/ja/story/50436363.md
- ko: https://zeli.app/ko/story/50436363 · markdown: https://zeli.app/ko/story/50436363.md
- de: https://zeli.app/de/story/50436363 · markdown: https://zeli.app/de/story/50436363.md
- es: https://zeli.app/es/story/50436363 · markdown: https://zeli.app/es/story/50436363.md
- ru: https://zeli.app/ru/story/50436363 · markdown: https://zeli.app/ru/story/50436363.md
