Overview
DevCPC includes powerful graphics conversion tools that automatically convert modern PNG images into Amstrad CPC formats. The tools handle palette conversion, format encoding, and optimization.Components
png2asm.py
Converts PNG images to ASM sprite data:- Input: PNG images (any size)
- Output: Z80 assembly sprite data
- Features: Automatic palette detection, mode validation, label generation
img.py (ABASM)
Converts PNG to SCN screen files:- Input: PNG images (160×200, 320×200, or 640×200)
- Output: 16KB SCN screen files
- Features: Full-screen conversion with palette info
Pillow (PIL)
Python Imaging Library for image processing:Sprite Conversion
Configuration
Enable sprite conversion indevcpc.conf:
devcpc.conf
Directory Structure
PNG Requirements
- Mode 0 (16 colors)
- Mode 1 (4 colors)
- Mode 2 (2 colors)
- Resolution: 160×200 max
- Sprite width: Multiple of 2 pixels
- Colors: Up to 16 colors from CPC palette
- Encoding: 2 pixels per byte (4 bits each)
CPC Palette
The converter maps RGB colors to the 27-color CPC palette:| INK | RGB | Name |
|---|---|---|
| 0 | (0,0,0) | Black |
| 1 | (0,0,128) | Blue |
| 2 | (0,0,255) | Bright Blue |
| 6 | (255,0,0) | Red |
| 24 | (255,255,0) | Yellow |
| 26 | (255,255,255) | White |
Tolerance
TheSPRITES_TOLERANCE setting controls color matching:
Generated ASM Format
ASM/sprites.asm
Using Sprites in Code
Screen Conversion
Configuration
Enable screen conversion indevcpc.conf:
devcpc.conf
Directory Structure
PNG Requirements
- Mode 0: 160×200 pixels (16 colors)
- Mode 1: 320×200 pixels (4 colors)
- Mode 2: 640×200 pixels (2 colors)
Generated Files
SCN File
Info File
Loading Screens
From BASIC:Manual Conversion
Run converters manually:Sprites
Screens
Creating Graphics
GIMP Workflow
Use CPC palette
Import CPC palette:
- Windows → Dockable Dialogs → Palettes
- Import CPC.gpl palette file
- Use Colors from palette only
Draw graphics
- Use Pencil tool (hard edges)
- Zoom in for pixel-perfect editing
- Use only colors from CPC palette
Aseprite Workflow
For sprite animation:- Create sprite at correct size (e.g., 16×16)
- Set palette to CPC colors
- Draw frames
- Export each frame as separate PNG
- Place in
assets/sprites/directory
Troubleshooting
Pillow not installed
Pillow not installed
Width not divisible error
Width not divisible error
Sprite width must be:
- Mode 0: multiple of 2 (2, 4, 6, 8, 10, 12, 14, 16…)
- Mode 1: multiple of 4 (4, 8, 12, 16, 20…)
- Mode 2: multiple of 8 (8, 16, 24, 32…)
Color not in CPC palette
Color not in CPC palette
Increase tolerance:Or use automatic:
Too many colors
Too many colors
Reduce colors in your image:
- Mode 0: max 16 colors
- Mode 1: max 4 colors
- Mode 2: max 2 colors
Resources
Graphics Guide
Complete graphics conversion guide
Loading Screens Recipe
Create and load screen graphics
Sprite Animation Recipe
Animate sprites in your games
Configuration
Graphics configuration reference
Credits
- png2asm.py by Javi Fernández
- img.py by fragarco
- 8bp-graphics-converter project