Pixel Portrait Maker
Pixel Portrait Maker (hereinafter the “Application”) is a free web app for building a pixel art character portrait from dozens of options and saving it as a PNG. Every portrait is a 64 by 64 pixel image, drawn in your browser, so there are no stored sprites and nothing is uploaded.
1. User Documentation
Section titled “1. User Documentation”The live instance is available at https://pixel.spellware.dev.
Making a Portrait
Section titled “Making a Portrait”- Open the page. It starts with a random portrait.
- Change any option, in any of the groups on the right. The portrait on the left updates as you move a slider.
- Select Download PNG to save it.
The first two groups, Face and Hair, are open when the page loads. Select the heading of any other group to open it, and select it again to close it. Each heading shows how many options the group holds.
The Options
Section titled “The Options”There are 57 options, plus a transparent background switch, in ten groups. Where a choice has a “none” setting, it is counted below.
| Group | What you can change |
|---|---|
| Face | Skin tone and tint, face width, jaw, ears, nose, blush and shoulders |
| Hair | 14 styles, colour, vividness, lightness, 5 fringes, 4 streak settings and the streak colour |
| Eyes | 8 shapes, colour, lightness, spacing, height, lashes, eyeshadow and its colour |
| Brows | 6 styles and 5 tones |
| Mouth | 9 expressions, 8 lipsticks and the height of the mouth |
| Face details | 7 facial hair styles and their colour, freckles, beauty marks, scars, face paint and its colour, age lines and piercings |
| Accessories | Glasses and their colour, headwear and its colour and shade, earrings, jewellery metal and necklaces |
| Outfit | 8 styles, colour, lightness, 5 patterns and the pattern colour |
| Background | 8 styles, colour, lightness, accent colour, 4 frames and the frame colour |
| Style | The outline: dark, a white sticker outline, or none |
Options with names, such as hair style, move in steps, and the name of the current choice is shown beside the slider. Colour sliders run around the colour wheel.
Colour Swatches
Section titled “Colour Swatches”Skin tone, hair colour and eye colour have a row of preset swatches under them. A hair or eye swatch sets every value that makes up that colour at once, so a single press gives you, for example, auburn hair. Every other colour slider has a row of eight general colours. Select a swatch to use it, then adjust the slider if you want a different shade.
Seed and Randomise
Section titled “Seed and Randomise”The Seed box holds the text that the current random portrait was made from. The same seed always makes the same portrait, on any device. Select Randomise for a new one, or type a seed of your own and press Enter or leave the box to use it. Anything that you change by hand after that is yours, and the seed no longer describes it.
The randomiser is weighted. Optional extras such as glasses, scars and face paint are usually left off, and common choices such as smiles are more likely than rare ones.
Select Reset to return every option to its starting value.
Saving a PNG
Section titled “Saving a PNG”Choose a size, then select Download PNG.
| Size | Scale |
|---|---|
| 64 px (original) | 1 |
| 256 px | 4 |
| 512 px | 8 |
| 1024 px | 16 |
| 2048 px | 32 |
Every size is a whole number multiple of the original, so each pixel stays a crisp square and nothing is blurred. Turn on Transparent background to save the figure alone, with nothing behind it. Combined with the white sticker outline, that makes a sticker.
Sharing a Portrait
Section titled “Sharing a Portrait”Select Copy share link. Anyone who opens the link sees exactly the portrait that you made, with every option as you set it. The portrait is carried in the part of the address after the #, so it is never sent to a server. You can also copy the address from your browser’s address bar, which always holds the current portrait.
If a link is damaged, or has values that are out of range, the Application replaces them with the starting values rather than showing a broken portrait.
Installing and Using Offline
Section titled “Installing and Using Offline”The Application is a progressive web app. Your browser can install it from its address bar or menu, and an installed copy keeps working without a connection. The first visit must be online so that the files can be saved.
The Page Looks Unstyled
Section titled “The Page Looks Unstyled”The page takes its header, footer and design from the shared SpellWare script. If that script has not loaded, for example on a very first offline visit, the Application falls back to plain styles and still works.
2. Technical Documentation
Section titled “2. Technical Documentation”The Application is a static web app, built with TypeScript and Vite. It has no server, and every portrait is drawn in the browser.
Local Setup
Section titled “Local Setup”pnpm installpnpm devThe dev server listens on port 8001.
| Command | What it does |
|---|---|
pnpm dev | Starts the Vite dev server |
pnpm build | Type-checks with tsc, then builds the app into dist/ |
pnpm preview | Serves the production build on port 8001 |
pnpm lint | Lints src with no warnings allowed |
pnpm test | Runs every test with coverage |
How a Portrait Is Drawn
Section titled “How a Portrait Is Drawn”Every part of the portrait is drawn directly on a 64 by 64 grid, in layers, from the hair behind the head to the accessories in front of it. Most parts are small bitmaps written as rows of text, where each character stands for a colour. The larger shapes, such as the head, the hair and the shoulders, are built from bands that are measured from the head outline.
The head outline is computed one row at a time from the face width and the jaw shape. The ears, the arms of the glasses, the beards, the hair and the mask that keeps facial features on the face all read the same measurements, so they line up whatever the settings.
src/core/portrait.ts stacks the layers in this order:
- Hair behind the head, with a strand texture.
- The hood, neck and clothing.
- The head.
- Facial hair.
- The ears, earrings and necklace.
- Freckles and age lines, then blush, nose, eyeshadow, brows, eyes and mouth, all kept on the head.
- Scars, face paint, moles and piercings, also kept on the head.
- Glasses, the front of the hair, then headwear.
- A one pixel outline around the whole figure.
- The background and frame, unless the background is transparent.
Settings and Share Links
Section titled “Settings and Share Links”All settings live in one table, src/core/settingsData.ts. The types, defaults, controls, randomiser and share links are all derived from it, so a setting cannot be added to one and forgotten in another.
A share link stores each value by its position in base 36, separated by dots, for example #s=1m.0.2.0...&t=0, where t is the transparent background switch. Because values are stored by position, the order of settingKeys is part of every link that has ever been shared. New settings must only ever be added to the end of that list.
Each value is corrected on the way in. A missing, invalid or out of range value is replaced with its default, so a damaged link can never produce an impossible portrait.
Randomness
Section titled “Randomness”A seed is hashed with FNV-1a and drives a mulberry32 generator, so the same seed gives the same portrait in every browser. Optional features carry a chance of being off, and a few controls favour their common choices. Skin, hair and eye colours are chosen from the same presets as the swatches, with the natural colours more likely than the unusual ones.
Project Layout
Section titled “Project Layout”| Path | Holds |
|---|---|
src/core/ | The drawing and settings logic. It uses no browser features and is fully unit tested |
src/ui/ | The editor: the option groups and swatches, the preview, and the download and share link buttons |
src/main.ts | The entry point |
src/styles.css | Styles specific to this app |
test/ | One Vitest spec for each area of src/core |
public/ | The app icons |
Browser Storage
Section titled “Browser Storage”The Application does not use local storage, session storage or cookies. The current portrait lives only in the address after the #. The service worker keeps the application files in the browser’s cache so that it works offline, and it also caches the shared SpellWare script, artwork and fonts as they are fetched.
Hosting
Section titled “Hosting”pnpm build writes a static site to dist/. nginx serves that directory at pixel.spellware.dev, as configured in the nginx-configs repository. The page, the service worker, its registration script and the manifest are sent with Cache-Control: no-cache, so an update always reaches an installed copy. The content hashed files, in assets/ and the worker’s runtime file, are cached for a year. An unknown path returns a 404 and is sent to the company 404 page.
Shared Headers
Section titled “Shared Headers”index.html loads the shared SpellWare headers script from https://cdn.spellware.dev/headers/index.js, with no features excluded. It adds the SpellWare header and footer, the page metadata and icons, the community popup, and the services listed in the legal section below. The Application’s own styles use the shared design tokens, with a fallback for each, so that the page still looks right if the script cannot load. The Application sits inside <main>, which the script turns into the page card. The page title beside the logo is set with data-nhcarrigan-title on the html element.
3. Legal Documentation
Section titled “3. Legal Documentation”The Application inherits SpellWare’s global legal documents:
- Privacy Policy: https://docs.spellware.dev/#/privacy
- Terms of Service: https://docs.spellware.dev/#/terms
- License: https://docs.spellware.dev/legal/license/
Data the Application Keeps
Section titled “Data the Application Keeps”The Application has no accounts and no server side storage. It does not keep anything in your browser’s storage, and it never uploads a portrait.
| Data | Kept |
|---|---|
| The portrait you are making | Only in the address after the #, which browsers never send to a server |
| The files you save | On your own device, where you choose to put them |
Services Loaded by the Shared Headers
Section titled “Services Loaded by the Shared Headers”Like our other websites, the page loads the shared SpellWare headers script, which loads the following services. A consent banner asks for your choices. Their use of your data is covered by the Privacy Policy and by each provider’s own terms. The portraits themselves are not sent to any of them.
| Service | Purpose |
|---|---|
| Secure Privacy | The cookie consent banner |
| Google Analytics | Measuring how the site is used |
| HubSpot | Site tracking and the chat widget |
| Google AdSense | Advertising |
| Tree-Nation | The tree planting widget in the footer |
4. Contributing Documentation
Section titled “4. Contributing Documentation”The Application’s repository is private, and it does not accept code contributions. Feedback and bug reports are welcome in the #bug-reports and #feature-requests forum channels in our Discord community.
Development Setup
Section titled “Development Setup”For maintainers, the project uses:
- TypeScript with the shared ESLint and TypeScript configs, and a zero warnings policy.
- Vitest for tests, with 100% coverage enforced on
src/core. - pnpm for package management.
pnpm installpnpm lintpnpm testpnpm buildAdding an Option
Section titled “Adding an Option”- Add the default to
defaultNumericSettings, and append its key to the end ofsettingKeys, insrc/core/settingsData.ts. - For a choice with names, add the names to
src/core/options.ts. - Add the control to
src/core/controls.ts, in the group it belongs to. Give an optional extra a chance of being off. - Draw it in the module for that part, and add any colour it needs to
src/core/palette.ts. - Add tests. The suite checks that every control has a default that is in range, that every option on every control renders without error, and, for most parts, that every choice looks different from the others.