Advanced Features
Lua scripting, font import, image import, and project management.
Lua Scripting
Miggy Draw includes a sandboxed Lua 5.4 environment for automating repetitive tasks, batch processing, and custom workflows.
Lua scripting is experimental. Some APIs may change in future releases.
Script Basics
Create scripts from the Scripts tab in the sidebar. Each script has access to the current project and its assets.
-- Example: Fill all sprites with a checkerboard pattern
local project = MiggyProject.current()
for _, sprite in ipairs(project:getSprites()) do
for y = 0, sprite:getHeight() - 1 do
for x = 0, sprite:getWidth() - 1 do
if (x + y) % 2 == 0 then
sprite:setPixel(x, y, 1)
else
sprite:setPixel(x, y, 2)
end
end
end
end
print("Processed " .. #project:getSprites() .. " sprites")
Bridge Objects
Scripts access Miggy Draw data through bridge objects:
| Object | Methods |
|---|---|
MiggyProject |
current(), getSprites(), getBobs(),
getBitmaps(), getPalettes(), createSprite(name, palette)
|
MiggyImage |
getWidth(), getHeight(), getPixel(x, y),
setPixel(x, y, color), clear()
|
MiggyPalette |
getColor(index), setColor(index, hex),
getBitplanes()
|
For safety, these functions are disabled in the sandbox: loadfile, dofile, io, os (except os.clock), debug, package.
Font Import
Convert TrueType fonts to bitmap fonts for use in your Amiga projects.
- Create a new font from the Fonts tab
- Click "Import from Font File"
- Select a .ttf or .otf file
- Configure the import settings:
- Size: Target pixel height
- Character range: Which glyphs to include
- Threshold: Anti-aliasing cutoff for 1-bit conversion
- Preview and adjust individual glyphs in the font editor
Start with pixel fonts or bitmap-friendly fonts (like Chicago, Monaco, or Topaz) for best results. Highly detailed fonts lose quality at small sizes.
Image Import
Import existing images (PNG, JPEG, BMP) and convert them to Amiga-compatible assets.
- Choose File → Import Image
- Select the source file
- Configure import settings:
- Target type: Sprite, BOB, or Bitmap
- Dimensions: Resize or maintain aspect ratio
- Color mapping: Create new palette or map to existing
- Dithering: Optional for better color approximation
The importer automatically reduces colors to fit the target bitplane depth, using the nearest available palette colors.
Project Management
Miggy Draw uses SwiftData for persistent storage. Your projects are automatically saved as you work.
Project Organization
- Favorites: Star projects for quick access
- Sorting: By name or date, ascending or descending
- Search: Filter projects by name in the sidebar
Export/Import Workflows
| Format | Use Case |
|---|---|
| JSON Bundle | Backup, version control, sharing projects |
| ZIP Archive | Complete code export with README |
| Individual Files | Export single assets for other tools |
Batch Operations
Export multiple projects at once from File → Export All Projects. Each project gets its own subfolder with complete code output.
JSON bundles are text-based and diff-friendly. Consider committing your .miggydraw bundles to Git alongside your Amiga source code.