Tcl/Tk wrapper around Pixie, a full-featured 2D graphics library written in 👑 Nim.
- Tcl/Tk 8.6 or higher
- MacOS (x64 / arm64)
- Windows x64
- Linux x64
Source distributions and binary packages can be downloaded here for the platforms mentioned above.
Note
I have mainly tested this package on Windows and MacOs x64 with version 8.6.16 and 9.0.1 of Tcl/Tk, it should work on Linux and MacOS arm (I hope so !)
If you want to build pix from source, please refer to BUILDING.md for detailed compilation instructions.
package require pix
# Init 'context' with size + color.
set ctx [pix::ctx::new {200 200} "white"]
# Style first rectangle.
pix::ctx::fillStyle $ctx "rgb(0, 0, 255)" ; # blue color
pix::ctx::fillRect $ctx {10 10} {100 100}
# Style second rectangle.
pix::ctx::fillStyle $ctx "rgba(255, 0, 0, 0.5)" ; # red color with alpha 50%
pix::ctx::fillRect $ctx {50 50} {100 100}
# Save context in a image file (*.png|*.bmp|*.qoi|*.ppm)
pix::ctx::writeFile $ctx rectangle.png
# Or display in label by example :
set p [image create photo]
pix::drawSurface $ctx $p
label .l -image $p
pack .lSee examples folder for more demos.
A large part of the pix documentation comes from the Pixie API and source files.
| API | Description |
|---|---|
| context | This namespace provides a 2D API commonly used on the web. |
| font | This namespace allows you to write text, load fonts. |
| image | Crop, resize, blur image and much more. |
| paint | This namespace plays with colors. |
| path | Vector Paths. |
| svg | Parse, render SVG (namespace pretty limited) |
Note
Since version 0.8, if available resvg is used to render SVG files in the pix::svg namespace.
- tclstubs-nimble (MIT)
- Pixie (MIT)
pix is covered under the terms of the MIT license.
- 03-Jun-2024 : 0.1
- Initial release.
- 25-Jun-2024 : 0.2
- Add
fontnamespace + test file. - Add
imagenamespace + test file. - Add
paintnamespace + test file. - Add
pathnamespace + test file. - Rename
pix::ctx::getSizebypix::ctx::get - Rename
pix::img::readbypix::img::readImage - Rename
pix::font::readbypix::font::readFont - Add documentation based on Pixie API reference.
- Add binary for Linux.
- Code refactoring.
- Add
- 06-Oct-2024 : 0.3
- Doc : Jpeg format is not supported for pix::ctx::writeFile.
- Rename
pix::parsePathtopix::pathObjToString - Add
pix::svgStyleToPathObjproc (convert SVG path string to path object) - Add
pix::rotMatrixproc (matrix rotation) - Fix bug
pix::path::fillOverlapsbad arguments, used. - Code refactoring.
- 02-Mar-2025 : 0.4
- Support for
Tcl/Tk9. - Adds binary for MacOS
arm64. - Adds
X11for purpose testing. - Code refactoring ++.
- Support for
- 03-Apr-2025 : 0.5
- Try to improve the comments for the documentation.
- Fixes bug for
pix::ctx::clip+pix::ctx::isPointInPath
procedures when args count was equal to 2. - Adds
pix::toBinaryprocedure. - Adds
pix::getKeysprocedure for image & context, useful for debugging. - Adds procedures for working with
matrices(translate, scale, multiply). - Adds
useMallocflag fornim ccommand. - Adds another test for fonts (works only with Tcl9)
- Reworks tests files (Compare the result with
pix::img::diffproc). - Simplification of some procedures + cosmetic changes.
- 07-Sep-2025 : 0.6
- Fix doc : Matrix values are in column order.
- Adds HSL color.
- Redefining Tcl/Tk procedures for transition to Nim version
2.2.4. - Fixes
setLineDashcommand to get around pixie's problem when Tcl list is not even. - Try to improve the
X11binding. - Cosmetic changes.
- 13-Oct-2025 : 0.7
- Adds new procedures for playing with colours (mix, darken,...).
- Improved compilation support.
- Bump
pixieto version5.1.0. - Refactoring matrix3x3 procedure.
- Fix doc: Matrix values are in row order (I think it's good now!).
- 17-Nov-2025 : 0.8
- Adds
hslcolor +spincommand. - Adds matrix inverse procedure.
- Adds
toGrayScaleprocedure. - Update
ruffversion to2.7.0. resvgrust library [C-API] for SVG rendering, is now a
part of this project (optional). From now on there will be two releases
distributions, one withresvgbinding and one without.- Previous versions
(v0.1-v0.7)includedRuff!documentation
assets without proper license attribution. This has been corrected inv0.8+.
- Adds

