1 |
8 |
zuofu |
NAME
|
2 |
|
|
img2xes - Convert various types of image files into an XES-formatted
|
3 |
|
|
hexadecimal data file
|
4 |
|
|
|
5 |
|
|
SYNOPSIS
|
6 |
|
|
perl img2xes.pl [-width=*integer*] [-x=*integer*] [-height=*integer*]
|
7 |
|
|
[-y=*integer*] [-depth=*string*] [-pixelwidth=*number*]
|
8 |
|
|
[-memwidth=*number*] [-address=*integer*] [-ifile=*filename*]
|
9 |
|
|
[-ofile=*filename*]
|
10 |
|
|
|
11 |
|
|
perl img2xes.pl -help
|
12 |
|
|
|
13 |
|
|
DESCRIPTION
|
14 |
|
|
img2xes converts image files into hexadecimal data files in the XES
|
15 |
|
|
format. These hex files can be downloaded into the memory on an XS Board
|
16 |
|
|
and displayed on a VGA monitor.
|
17 |
|
|
|
18 |
|
|
OPTIONS
|
19 |
|
|
-width *integer*
|
20 |
|
|
Sets width of the image (in pixels) that will be displayed on the
|
21 |
|
|
VGA monitor. This is not necessarily the same as the width of the
|
22 |
|
|
image in the image file. The default value is 800.
|
23 |
|
|
|
24 |
|
|
-x *integer*
|
25 |
|
|
Same as the -width option.
|
26 |
|
|
|
27 |
|
|
-height *integer*
|
28 |
|
|
Sets height of the image (in scanlines) that will be displayed on
|
29 |
|
|
the VGA monitor. This is not necessarily the same as the height of
|
30 |
|
|
the image in the image file. The default value is 600.
|
31 |
|
|
|
32 |
|
|
-y *integer*
|
33 |
|
|
Same as the -height option.
|
34 |
|
|
|
35 |
|
|
-depth *string*
|
36 |
|
|
Sets the depth of the image that will be displayed on the VGA
|
37 |
|
|
monitor. This is not necessarily the same as the depth of the image
|
38 |
|
|
in the image file. The depth is expressed as a string with the
|
39 |
|
|
format *R+G+B* where R, G and B are the number of bits of resolution
|
40 |
|
|
of the red, green and blue components of the colors displayed on the
|
41 |
|
|
monitor. The default value is 3+2+3.
|
42 |
|
|
|
43 |
|
|
-pixelwidth *integer*
|
44 |
|
|
Sets the width (in bits) of a pixel. A pixel should be at least
|
45 |
|
|
R+G+B bits wide. The default value is 8.
|
46 |
|
|
|
47 |
|
|
-memwidth *integer*
|
48 |
|
|
Sets the width (in bits) of the memory word that contains one or
|
49 |
|
|
more pixels. The memory width should be at least as wide as the
|
50 |
|
|
pixels. The default value is 16.
|
51 |
|
|
|
52 |
|
|
-address *hex or octal address*
|
53 |
|
|
Sets the starting address in memory for the hexadecimal image data.
|
54 |
|
|
The image data proceeds upward from there. The address is
|
55 |
|
|
interpreted as an octal number unless you precede it with an initial
|
56 |
|
|
"0x" to indicate it is a hexadecimal address. The default value is
|
57 |
|
|
0.
|
58 |
|
|
|
59 |
|
|
-ifile *filename*
|
60 |
|
|
Gives the name of the file containing the image data. The suffix of
|
61 |
|
|
*filename* is used to determine the type of the image data as
|
62 |
|
|
follows:
|
63 |
|
|
|
64 |
|
|
.bmp Windows bitmap file.
|
65 |
|
|
.png PNG file.
|
66 |
|
|
.gif GIF file.
|
67 |
|
|
.tif TIF file.
|
68 |
|
|
.jpeg, .jpg JPEG file.
|
69 |
|
|
.pgm Portable gray-map file.
|
70 |
|
|
.ppm Portable pixel-map file.
|
71 |
|
|
.pnm Portable any-map file.
|
72 |
|
|
|
73 |
|
|
If -ifile is not used, then the image data is read from the standard
|
74 |
|
|
input and is assumed to be in portable any-map format.
|
75 |
|
|
|
76 |
|
|
-ofile *filename*
|
77 |
|
|
Gives the name of the file where the XES-formatted hexadecimal data
|
78 |
|
|
will be stored. If -ofile is not used, then the hexadecimal data is
|
79 |
|
|
written to the standard output.
|
80 |
|
|
|
81 |
|
|
DIAGNOSTICS
|
82 |
|
|
img2xes will abort if it does not recognize the suffix of the input
|
83 |
|
|
image file or if the following contraint is not met:
|
84 |
|
|
|
85 |
|
|
R+G+B <= pixel width <= memory width
|
86 |
|
|
|
87 |
|
|
EXAMPLES
|
88 |
|
|
For the XSA Boards using the VGA generator circuit described in
|
89 |
|
|
http://www.xess.com/appnotes/an-101204-vgagen.pdf, here are the commands
|
90 |
|
|
to convert a JPEG file and produce an 800 x 600 display with pixel
|
91 |
|
|
widths of 4, 8 and 16. (We will not explicitly set some options since
|
92 |
|
|
the default settings will work in this case)
|
93 |
|
|
|
94 |
|
|
perl img2xes.pl -depth 1+1+1 -pixelwidth 4 -ifile image.jpg -ofile
|
95 |
|
|
image.xes
|
96 |
|
|
|
97 |
|
|
perl img2xes.pl -depth 3+2+3 -pixelwidth 8 -ifile image.jpg -ofile
|
98 |
|
|
image.xes
|
99 |
|
|
|
100 |
|
|
perl img2xes.pl -depth 3+3+3 -pixelwidth 16 -ifile image.jpg -ofile
|
101 |
|
|
image.xes
|
102 |
|
|
|
103 |
|
|
To display a PNG file on a 1024 x 768 display, then do this:
|
104 |
|
|
|
105 |
|
|
perl img2xes.pl -x 1024 -y 768 -depth 1+1+1 -pixelwidth 4 -ifile
|
106 |
|
|
image.png -ofile image.xes
|
107 |
|
|
|
108 |
|
|
perl img2xes.pl -x 1024 -y 768 -depth 3+2+3 -pixelwidth 8 -ifile
|
109 |
|
|
image.png -ofile image.xes
|
110 |
|
|
|
111 |
|
|
perl img2xes.pl -x 1024 -y 768 -depth 3+3+3 -pixelwidth 16 -ifile
|
112 |
|
|
image.png -ofile image.xes
|
113 |
|
|
|
114 |
|
|
ENVIRONMENT
|
115 |
|
|
img2xes requires a perl interpreter for its execution. You can get a
|
116 |
|
|
free perl interpreter for Windows at www.activestate.com. You already
|
117 |
|
|
have a perl interpreter if you are running linux, solaris or unix.
|
118 |
|
|
|
119 |
|
|
img2xes requires the *netpbm* suite of image conversion programs in
|
120 |
|
|
order to convert the various image file formats. You can get these from
|
121 |
|
|
http://netpbm.sourceforge.net. Once installed, you need to place the
|
122 |
|
|
*netpbm* directory in your path or store it directly in the
|
123 |
|
|
$netpbm_bin_dir variable in img2xes.pl.
|
124 |
|
|
|
125 |
|
|
FILES
|
126 |
|
|
None.
|
127 |
|
|
|
128 |
|
|
CAVEATS
|
129 |
|
|
None.
|
130 |
|
|
|
131 |
|
|
BUGS
|
132 |
|
|
Portable bitmap files (.pbm) are not handled, yet.
|
133 |
|
|
|
134 |
|
|
RESTRICTIONS
|
135 |
|
|
None.
|
136 |
|
|
|
137 |
|
|
NOTES
|
138 |
|
|
img2xes takes the red, green and blue component values of each pixel in
|
139 |
|
|
the image file and does the following:
|
140 |
|
|
|
141 |
|
|
1. Each color component is truncated to the number of bits specified
|
142 |
|
|
for that component by the -depth option.
|
143 |
|
|
|
144 |
|
|
2. The truncated color components are concatenated with the blue
|
145 |
|
|
component in the least-significant bit positions, the red component
|
146 |
|
|
in the most-significant bit positions, and the green component in
|
147 |
|
|
between.
|
148 |
|
|
|
149 |
|
|
3. The concatenated components are placed into the least-significant
|
150 |
|
|
bit positions of a pixel field whose width is set using the
|
151 |
|
|
-pixelwidth option. Any unused bits in the upper portion of the
|
152 |
|
|
pixel field are set to zero.
|
153 |
|
|
|
154 |
|
|
4. Pixel fields are concatenated until no more will fit into a memory
|
155 |
|
|
word whose width is set using the -memwidth option. Pixel *N*
|
156 |
|
|
occupies the least-significant bit positions while pixels *N+1*,
|
157 |
|
|
*N+2*, ... occupy successively more-significant bit positions in the
|
158 |
|
|
memory word.
|
159 |
|
|
|
160 |
|
|
5. The memory word is chopped into eight-bit bytes and output as
|
161 |
|
|
two-digit hexadecimal values starting with the most-significant byte
|
162 |
|
|
and proceeding to the least-significant byte.
|
163 |
|
|
|
164 |
|
|
SEE ALSO
|
165 |
|
|
The most-current version of img2xes.pl can be found at
|
166 |
|
|
http://wwww.xess.com/ho07000.html.
|
167 |
|
|
|
168 |
|
|
AUTHOR
|
169 |
|
|
Dave Vanden Bout, X Engineering Software Systems Corp.
|
170 |
|
|
|
171 |
|
|
Send bug reports to bugs@xess.com.
|
172 |
|
|
|
173 |
|
|
COPYRIGHT AND LICENSE
|
174 |
|
|
Copyright 2004 by X Engineering Software Systems Corporation.
|
175 |
|
|
|
176 |
|
|
This library is free software; you may redistribute it and/or modify it
|
177 |
|
|
under the same terms as Perl itself.
|
178 |
|
|
|
179 |
|
|
HISTORY
|
180 |
|
|
10/12/04 - Version 1.0
|
181 |
|
|
|