Overview
DevCPC can automatically convert PNG images to Amstrad CPC formats during the build process:- Sprites: PNG → ASM data files for use in your game
- Screens: PNG → SCN binary files for loading screens
Requires Python Pillow library:
pip3 install PillowCPC Video Modes
TheMODE setting determines the video mode for all graphics conversions.
MODE=0: 16 Colors
devcpc.conf
- Resolution: 160×200 pixels
- Colors: 16 simultaneous colors (from 27-color palette)
- Encoding: 2 pixels per byte (4 bits per pixel)
- Best for: Colorful games, detailed sprites, most projects
- Width: Multiple of 2 pixels
- Height: Any
- Colors: Maximum 16 colors
- For screens: Exactly 160×200 pixels
MODE=1: 4 Colors
devcpc.conf
- Resolution: 320×200 pixels
- Colors: 4 simultaneous colors (from 27-color palette)
- Encoding: 4 pixels per byte (2 bits per pixel)
- Best for: Higher resolution games, text-heavy interfaces
- Width: Multiple of 4 pixels
- Height: Any
- Colors: Maximum 4 colors
- For screens: Exactly 320×200 pixels
MODE=2: 2 Colors
devcpc.conf
- Resolution: 640×200 pixels
- Colors: 2 colors (typically black and white)
- Encoding: 8 pixels per byte (1 bit per pixel)
- Best for: Hi-res monochrome graphics, arcade ports
- Width: Multiple of 8 pixels
- Height: Any
- Colors: Maximum 2 colors
- For screens: Exactly 640×200 pixels
CPC Color Palette
The Amstrad CPC has a fixed 27-color palette (INK 0-26). DevCPC automatically converts PNG RGB colors to the nearest CPC ink.Hardware Palette
| INK | Color | RGB | Hex |
|---|---|---|---|
| 0 | Black | (0,0,0) | #000000 |
| 1 | Blue (dark) | (0,0,128) | #000080 |
| 2 | Blue | (0,0,255) | #0000FF |
| 3 | Red (dark) | (128,0,0) | #800000 |
| 4 | Magenta (dark) | (128,0,128) | #800080 |
| 5 | Magenta | (128,0,255) | #8000FF |
| 6 | Red | (255,0,0) | #FF0000 |
| 7 | Pink | (255,0,128) | #FF0080 |
| 8 | Pink (light) | (255,0,255) | #FF00FF |
| 9 | Green (dark) | (0,128,0) | #008000 |
| 10 | Cyan (dark) | (0,128,128) | #008080 |
| 11 | Cyan | (0,128,255) | #0080FF |
| 12 | Yellow (dark) | (128,128,0) | #808000 |
| 13 | Gray | (128,128,128) | #808080 |
| 14 | Blue (pastel) | (128,128,255) | #8080FF |
| 15 | Orange | (255,128,0) | #FF8000 |
| 16 | Pink (pastel) | (255,128,128) | #FF8080 |
| 17 | Lilac | (255,128,255) | #FF80FF |
| 18 | Green | (0,255,0) | #00FF00 |
| 19 | Aqua | (0,255,128) | #00FF80 |
| 20 | Cyan (light) | (0,255,255) | #00FFFF |
| 21 | Yellow-green | (128,255,0) | #80FF00 |
| 22 | Green (pastel) | (128,255,128) | #80FF80 |
| 23 | Cyan (pastel) | (128,255,255) | #80FFFF |
| 24 | Yellow | (255,255,0) | #FFFF00 |
| 25 | Yellow (pastel) | (255,255,128) | #FFFF80 |
| 26 | White | (255,255,255) | #FFFFFF |
Sprite Configuration
SPRITES_PATH
Directory containing PNG sprite files.devcpc.conf
- Type: Directory path
- Search: Recursive (includes all subdirectories)
- Process: Converts all PNG files to ASM format
- Timing: Runs before ASM compilation during
devcpc build
SPRITES_OUT_FILE
Output file for generated sprite data.devcpc.conf
- Type: File path
- Default:
"sprites.asm"(in project root) - Format: ASM file with sprite data and palette information
- Usage: Include in your ASM with
include "sprites.asm"
SPRITES_TOLERANCE
RGB color matching tolerance.devcpc.conf
- Type: Integer
- Values:
0= Exact match (RGB must exactly match CPC palette)1-255= Tolerance in RGB delta (8 is recommended)-1= Automatic (always finds closest color)
- Default: 8
- Recommendation: Use 8 for most projects
SPRITES_TRANSPARENT_INK
INK to use for transparent pixels.devcpc.conf
- Type: Integer (0-26) or empty
- Default: Empty (no special transparency handling)
- Usage: Maps PNG alpha=0 pixels to specified INK
- Example:
SPRITES_TRANSPARENT_INK=0treats transparent pixels as black
Leave empty for no transparency, or set to your background INK color.
Screen Configuration
LOADER_SCREEN
Directory containing PNG loading screen files.devcpc.conf
- Type: Directory path
- Search: Recursive (includes all subdirectories)
- Process: Converts PNG to SCN format (16KB binary screen dump)
- Address: SCN files load at &C000 (video memory)
- Timing: Runs before ASM compilation during
devcpc build
obj/filename.scn- Binary screen dump (16384 bytes)obj/filename.scn.info- Palette and format information
Sprite Conversion Examples
Example 1: Simple Sprites
Configuration:devcpc.conf
Example 2: Organized Sprites
Configuration:devcpc.conf
ASM/graphics/sprites.asm.
Screen Conversion Examples
Example 3: Loading Screens
Configuration:devcpc.conf
Example 4: SCN Info File
Content oftitle.scn.info:
Troubleshooting Graphics
Error: Pillow Not Installed
Error:Error: Width Not Divisible
Error:- Mode 0: Width must be multiple of 2
- Mode 1: Width must be multiple of 4
- Mode 2: Width must be multiple of 8
Error: Too Many Colors
Error:- Reduce colors in your PNG editor
- Use indexed color mode with CPC palette
- Or change to MODE 0 (16 colors) if using MODE 1/2
Error: Color Not in Palette
Error:- Increase tolerance:
SPRITES_TOLERANCE=16 - Use auto-match:
SPRITES_TOLERANCE=-1 - Or adjust PNG colors to exact CPC palette values
Error: Screen Wrong Resolution
Error:- Mode 0: 160×200 pixels
- Mode 1: 320×200 pixels
- Mode 2: 640×200 pixels
Tips
Complete Graphics Example
devcpc.conf
See Also
- Build Options - MODE and build settings
- Paths Configuration - Graphics path details
- Build Command - Compilation workflow