Vier
Vier is a keyboard-focused pixel art editor heavily inspired by Vim.
Installation
Vier is written in Nim, so the language and its tooling must be installed.
For GNU/Linux, just use the command
nimble install https://git.sr.ht/~xigoi/vier
Alternatively, you can install directly from the repository:
git clone https://git.sr.ht/~xigoi/vier
nimble install
Note that you need to have $HOME/.nimble/bin
in your $PATH
.
Usage
Launch Vier via the command line on the picture(s) you want to edit:
vier cat.png dog.png
Alternatively, you can launch it without arguments to create a new picture:
vier
Modes and Tools
In most graphics editing programs, there is the concept of a tool, a state of the editor which determines what action is performed when clicking on an image. This is also the case for Vier, but like in Vim, there is also the concept of modes – a state which affects more generally how keys are interpreted.
Vier has these modes:
- Inject mode
- In this mode, the user can move around the selected picture using HJKL keys and draw with the currently selected tool. The color of the pixels being drawn is replaced by the selected color, so this can also work as an “eraser” if the selected color is transparent. If multiple pictures are opened, they can be switched between using Ctrl-H and Ctrl-L.
- Add mode
- In this mode, the user can move around the selected picture using HJKL keys and draw with the currently selected tool. The selected color is added on the color of the pixels being drawn, which allows shading an area with a transparent color. If multiple pictures are opened, they can be switched between using Ctrl-H and Ctrl-L.
- Select mode
- In this mode, the user can move around the selected picture using HJKL keys and select a part of the picture using the currently selected tool. If multiple pictures are opened, they can be switched between using Ctrl-H and Ctrl-L.
- Color mode
- In this mode, the user can move around a color palette (displayed at the top of the screen) to change the selected color (displayed in the upper left corner). If multiple palettes are available, they can be switched between using Ctrl-H and Ctrl-L.
- Command mode
- In this mode, the user can enter a command, displayed at the bottom of the screen, to perform complex actions such as opening a file. The commands are in the Spry programming language, though this is not important for basic usage. The command is executed by pressing ⏎ or cancelled by pressing Esc.
The following tools are available:
- Brush
- The brush tool selects pixels that it moves over.
- Segment
- The segment tool selects a line segment.
- Rectangle
- The rectangle tool selects an axis-aligned rectangle.
- Flood
- The flood tool selects a contiguous area of pixels with the same color.
Keyboard mappings
The key mappings are inspired by Vim. They are currently not customizable.
Key | Alone | Shift | Control |
⎵ | hold to draw |
A | Mode ← Add |
B | Tool ← Brush |
C | Mode ← Color |
F | Tool ← Flood |
H | move left | | previous picture/palette |
I | Mode ← Inject |
J | move down | |
K | move up | |
L | move right | | next picture/palette |
Q | quit | force quit |
R | Tool ← Rectangle | | redo |
S | Tool ← Segment |
U | undo |
V | Mode ← Select |
W | write picture | write all pictures |
X | swap colors |
- | zoom out | zoom out all pictures |
= | zoom in | zoom in all pictures |
; | Mode ← Command |
Note that the mouse can also be used to draw and select colors. The right mouse button draws with the secondary color.
Commands
e image.png
- open a file for editing (the filename is a symbol)
edit "image.png"
- open a file for editing (the filename is a string)
flip-x
- flip the current picture horizontally
flip-y
- flip the current picture vertically
new
- create a new picture with a transparent background and the default size
resize-nn 16 8
- resize the current picture using the nearest-neighbor algorithm
w image.png
- save the current picture under the specified filename (the filename is a symbol)
write "image.png"
- save the current picture under the specified filename (the filename is a string)
Note that currently, edits done via commands are not added to undo history and break it.
Planned features
Roughly in order of priority.
- upscaling (various algorithms)
- ellipse tool
- eyedropper tool
- mirrored drawing
- color picker, palette editing
- programmable configuration
- gradients
- animated sprite editing
Name
I partially created Vier as a semestral project for a Computer Graphics course at my university. The name of the lecturer can be loosely translated as “fear”, so I decided to name the project after a German word which is pronounced the same way. The word means “four”, which hints at the editor treating images as a square grid (with squares having four sides, obviously). I also came up with the backronym “Vim-Inspired Editor of Rasters”.