URL
https://opencores.org/ocsvn/395_vgs/395_vgs/trunk
Subversion Repositories 395_vgs
[/] [395_vgs/] [trunk/] [devkit/] [img2xes/] [img2xes_manual.txt] - Rev 32
Compare with Previous | Blame | View Log
NAME
img2xes - Convert various types of image files into an XES-formatted
hexadecimal data file
SYNOPSIS
perl img2xes.pl [-width=*integer*] [-x=*integer*] [-height=*integer*]
[-y=*integer*] [-depth=*string*] [-pixelwidth=*number*]
[-memwidth=*number*] [-address=*integer*] [-ifile=*filename*]
[-ofile=*filename*]
perl img2xes.pl -help
DESCRIPTION
img2xes converts image files into hexadecimal data files in the XES
format. These hex files can be downloaded into the memory on an XS Board
and displayed on a VGA monitor.
OPTIONS
-width *integer*
Sets width of the image (in pixels) that will be displayed on the
VGA monitor. This is not necessarily the same as the width of the
image in the image file. The default value is 800.
-x *integer*
Same as the -width option.
-height *integer*
Sets height of the image (in scanlines) that will be displayed on
the VGA monitor. This is not necessarily the same as the height of
the image in the image file. The default value is 600.
-y *integer*
Same as the -height option.
-depth *string*
Sets the depth of the image that will be displayed on the VGA
monitor. This is not necessarily the same as the depth of the image
in the image file. The depth is expressed as a string with the
format *R+G+B* where R, G and B are the number of bits of resolution
of the red, green and blue components of the colors displayed on the
monitor. The default value is 3+2+3.
-pixelwidth *integer*
Sets the width (in bits) of a pixel. A pixel should be at least
R+G+B bits wide. The default value is 8.
-memwidth *integer*
Sets the width (in bits) of the memory word that contains one or
more pixels. The memory width should be at least as wide as the
pixels. The default value is 16.
-address *hex or octal address*
Sets the starting address in memory for the hexadecimal image data.
The image data proceeds upward from there. The address is
interpreted as an octal number unless you precede it with an initial
"0x" to indicate it is a hexadecimal address. The default value is
0.
-ifile *filename*
Gives the name of the file containing the image data. The suffix of
*filename* is used to determine the type of the image data as
follows:
.bmp Windows bitmap file.
.png PNG file.
.gif GIF file.
.tif TIF file.
.jpeg, .jpg JPEG file.
.pgm Portable gray-map file.
.ppm Portable pixel-map file.
.pnm Portable any-map file.
If -ifile is not used, then the image data is read from the standard
input and is assumed to be in portable any-map format.
-ofile *filename*
Gives the name of the file where the XES-formatted hexadecimal data
will be stored. If -ofile is not used, then the hexadecimal data is
written to the standard output.
DIAGNOSTICS
img2xes will abort if it does not recognize the suffix of the input
image file or if the following contraint is not met:
R+G+B <= pixel width <= memory width
EXAMPLES
For the XSA Boards using the VGA generator circuit described in
http://www.xess.com/appnotes/an-101204-vgagen.pdf, here are the commands
to convert a JPEG file and produce an 800 x 600 display with pixel
widths of 4, 8 and 16. (We will not explicitly set some options since
the default settings will work in this case)
perl img2xes.pl -depth 1+1+1 -pixelwidth 4 -ifile image.jpg -ofile
image.xes
perl img2xes.pl -depth 3+2+3 -pixelwidth 8 -ifile image.jpg -ofile
image.xes
perl img2xes.pl -depth 3+3+3 -pixelwidth 16 -ifile image.jpg -ofile
image.xes
To display a PNG file on a 1024 x 768 display, then do this:
perl img2xes.pl -x 1024 -y 768 -depth 1+1+1 -pixelwidth 4 -ifile
image.png -ofile image.xes
perl img2xes.pl -x 1024 -y 768 -depth 3+2+3 -pixelwidth 8 -ifile
image.png -ofile image.xes
perl img2xes.pl -x 1024 -y 768 -depth 3+3+3 -pixelwidth 16 -ifile
image.png -ofile image.xes
ENVIRONMENT
img2xes requires a perl interpreter for its execution. You can get a
free perl interpreter for Windows at www.activestate.com. You already
have a perl interpreter if you are running linux, solaris or unix.
img2xes requires the *netpbm* suite of image conversion programs in
order to convert the various image file formats. You can get these from
http://netpbm.sourceforge.net. Once installed, you need to place the
*netpbm* directory in your path or store it directly in the
$netpbm_bin_dir variable in img2xes.pl.
FILES
None.
CAVEATS
None.
BUGS
Portable bitmap files (.pbm) are not handled, yet.
RESTRICTIONS
None.
NOTES
img2xes takes the red, green and blue component values of each pixel in
the image file and does the following:
1. Each color component is truncated to the number of bits specified
for that component by the -depth option.
2. The truncated color components are concatenated with the blue
component in the least-significant bit positions, the red component
in the most-significant bit positions, and the green component in
between.
3. The concatenated components are placed into the least-significant
bit positions of a pixel field whose width is set using the
-pixelwidth option. Any unused bits in the upper portion of the
pixel field are set to zero.
4. Pixel fields are concatenated until no more will fit into a memory
word whose width is set using the -memwidth option. Pixel *N*
occupies the least-significant bit positions while pixels *N+1*,
*N+2*, ... occupy successively more-significant bit positions in the
memory word.
5. The memory word is chopped into eight-bit bytes and output as
two-digit hexadecimal values starting with the most-significant byte
and proceeding to the least-significant byte.
SEE ALSO
The most-current version of img2xes.pl can be found at
http://wwww.xess.com/ho07000.html.
AUTHOR
Dave Vanden Bout, X Engineering Software Systems Corp.
Send bug reports to bugs@xess.com.
COPYRIGHT AND LICENSE
Copyright 2004 by X Engineering Software Systems Corporation.
This library is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
HISTORY
10/12/04 - Version 1.0