Title | palutils (Image and palette utilities for embedded systems design). |
Author | Nikolaos Kavvadias 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 |
Contact | nikos@nkavvadias.com |
Website | http://www.nkavvadias.com |
Release Date | 24 February 2014 |
Version | 1.0.0 |
Rev. history | |
v1.0.0 | 2014-02-24 Converted documentation to RestructuredText format. Cleaned up directory organization and removed generated files. Upgraded to version 1.0.0. |
v0.0.6 | 2009-03-19 Added "-manhattan" and "-chessboard" options for calculating the Manhattan and chessboard distances (non- Euclidean geometries) of greyscale images. Considered experimental. |
v0.0.5 | 2009-03-11 Added "-epx" option for "Eric's Pixel eXpansion" image scaling filter. |
v0.0.4 | 2008-12-13 Added "-c27" option (27-color image format). |
v0.0.3 | 2008-08-27 Documentation (README) fixes. |
v0.0.2 | 2008-03-10 First public release. |
palutils (palette and image utilities) is a collection of handy tools for processing of image files (mainly 8-bit indexed palette bitmaps). Its main focus is on the usage of image files in small-scale embedded systems.
Currently, the palutils collection consists of the following programs:
The palutils distribution includes the following files:
/palutils | Top-level directory |
/doc | Documentation directory |
AUTHORS | List of palutils authors. |
BUGS | Bug list. |
ChangeLog | A log for code changes. |
COPYING | The GPL, version 2, which governs palutils |
NEWS | Development news for the palutils project. |
README | This file. |
README.html | HTML version of README. |
README.pdf | PDF version of README. |
rst2docs.sh | Bash script for generating the HTML and PDF versions. |
THANKS | Acknowledgements. |
TODO | A list of future enhancements. |
VERSION | Current version of the project sources. |
/scripts | Scripts directory |
binopgen.sh | Generate greyscale images using the generating function: f(x,y) = x binop y |
bmpembed.sh | Initialize a VHDL ROM/RAM memory from a BMP file. |
chaosgen.sh | Generate pseudo-chaotic black-and-white images based on a trick function by Donald E. Knuth (TAOCP, Vol. 4, Bitwise Tricks and Techniques). |
dump2bmp.sh | Convert an image dump file to a Windows bitmap (BMP). |
dumptrad2bmp.sh | Convert a "traditional" image dump file (using either the C8 or the C27 format to a BMP file. |
fractalgen.sh | Generate fractal images. |
imgprocess.sh | Generate pseudocolor images for 256-level greyscale images. |
lenseffect.sh | Produce "lens-distorted" image. |
make_char_rom.sh | Create a font character ROM. |
negeffect.sh | Produce "negative" image. |
roteffect.sh | Generate pseudocolor images by applying a rotation effect. |
rwalkgen.sh | Generate random walk images. |
sepiaeffect.sh | Apply the "Sepia" filtering effect on 256-color palette images. |
/src | Source code directory |
bmp2any.c | Bitmap file converter to a number of output formats. |
genpalette.c | Generates palettes from a predefined selection set. The generated palettes are compatible with GIMP and mtpaint. |
genpltenc.c | Generates all 256-color palette encodings that can be represented using only the index encodings relations (of the image data). |
memgen.c | Program/data memory generator (Block-RAM based). |
palutils.c | Image and palette utilities for embedded systems design. |
/tests | Main test files directory |
/tests/bitmaps | Included bitmap (BMP) files for testing |
*.bmp | Various BMP images. |
/tests/bitmaps | Included bitmap (BMP) files for testing |
*.bmp | Various BMP images. |
/tests/fonts | Font collection as BMP files |
*.bmp | The OEM, S8x16 and XL fonts as BMP files. |
/tests/hexdumps | Hex dumps generated from the font BMP files |
*.txt | Hexadecimal dumps for the OEM, S8x16 and XL fonts. |
/tests/imgdumps | Image ASCII dump files |
*.txt | ASCII dump files from raster images, mostly in the C8 and C27 custom formats. |
/tests/palettes | Palette files |
*.txt | Sample GPL files for GIMP and mtpaint. |
The palutils program can be invoked with several options (see complete options listing below). The usual tasks that can be accomplished with palutils are:
palutils can be invoked as:
The complete palutils options listing:
Here follow some simple usage examples of palutils.
where for example:
The bmp2any utility extracts the image data from a bitmap (BMP) file and dumps them to the specified format. bmp2any can be invoked as follows:
with the following options:
Usually, bmp2any is used for generating a hex dump of the image data contents of a BMP file. This can be done with the following command:
The memgen utility converts a hex dump to an initialized block RAM. It can be used for initializing block RAMs with BMP image data. memgen` is inspired but does not share any code with the ram_image utility of the Plasma (mlite) processor soft-core distribution at the OpenCores website.
memgen can be invoked as follows:
with the following options:
The following example generates a VHDL package containing the signal declarations and initializations for the data that are stored in the block RAM(s).
The genpalette utility generates palettes from a predefined set of possible selections. The generated palettes are compatible with GIMP and mtPaint.
genpalette can be invoked as follows:
with the following options:
The following examples generates a 256-level greyscale palette.
The palutils distribution includes a number of bash scripts that make use of the utilities in the package. The usage of these scripts is explained below:
Convert an 256-color (or 256-level greyscale) BMP image file to the corresponding VHDL source code for inclusion in the data memory module of the "kaviMIPS" processor.
Usage: | $ ./bmpembed.sh <input-base> <output-base> -[c8|c256|g256] <size>
Example: | $ ./bmpembed.sh scomet2_8bpp_g scomet2 -c256 8192
Convert an image dump data file (generated by a VHDL simulation) to a 256-color bitmap file.
Usage: | $ ./dump2bmp.sh <base-name> <x-size> <y-size>
Example: | $ ./dump2bmp.sh dmem 64 64
Convert an image dump data file (generated by a VHDL simulation, using the traditional format of 8 or 27-color information) to a 256-color bitmap file.
Usage: | $ ./dump2bmp.sh <base-name> <x-size> <y-size>
Example: | $ ./dump2bmp.sh dmem 64 64
Apply image processing procedures to BMP files. As of current, adding pseudocolors to greyscale BMP images is the only feature supported.
Usage: | $ ./imgprocess.sh
A script that creates a font character VHDL ROM from a hex data file. The ROM data (text file) are expected in the following form:
<hex-byte> ... <hex-byte>
A maximum of 2048 lines (for Spartan-3/3E block RAMs) can be assigned. Output of this process is a VHDL synchronous-read, synchronous-write ROM that can be implemented with a block RAM.
Usage: | $ ./make_char_rom.sh <font-name>
The supported image formats in palutils are:
An image data dump format for describing 8-color (RGB-3) pixels. Each color is represented by a single character. The following table provides the color encodings and their character assignments:
R G B Char Description 0 0 0 N Black (Noir) 0 0 1 B Blue 0 1 0 G Green 0 1 1 C Cyan 1 0 0 R Red 1 0 1 M Magenta 1 1 0 Y Yellow 1 1 1 W White
An image data dump format for describing 27-color (3-levels: low-, mid-, high per R,G,B) pixels. Each color is represented by a single character. The following table provides the color encodings and their character assignments:
R G B Char Description 00 00 00 N Black (Noir) 00 00 01 n Navy Blue 00 00 10 B Blue 00 01 00 A Avocado 00 01 01 s Teal 00 01 10 a Azure 00 10 00 G Green 00 10 01 E Spring Green 00 10 10 C Cyan 01 00 00 b Maroon (Brown) 01 00 01 P Medium Purple 01 00 10 I Indigo 01 01 00 K Olive (Khaki) 01 01 01 g Gray 01 01 10 i Indigo Gray 01 10 00 L Chartreuse 01 10 01 r Light Green 01 10 10 c Light Cyan 10 00 00 R Red 10 00 01 H Rose (Hot Pink) 10 00 10 M Magenta 10 01 00 O Orange 10 01 01 S Skintone 10 01 10 m Light Magenta 10 10 00 Y Yellow 10 10 01 y Light Yellow 10 10 10 W White
8-bit paletted color bitmaps
8-bit greyscale bitmaps
There exists a quite portable Makefile (Makefile in /src directory). Running make should compile all files: palutils, bmp2any, memgen and genpltenc.