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
NAMEimg2xes - Convert various types of image files into an XES-formattedhexadecimal data fileSYNOPSISperl 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 -helpDESCRIPTIONimg2xes converts image files into hexadecimal data files in the XESformat. These hex files can be downloaded into the memory on an XS Boardand displayed on a VGA monitor.OPTIONS-width *integer*Sets width of the image (in pixels) that will be displayed on theVGA monitor. This is not necessarily the same as the width of theimage 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 onthe VGA monitor. This is not necessarily the same as the height ofthe 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 VGAmonitor. This is not necessarily the same as the depth of the imagein the image file. The depth is expressed as a string with theformat *R+G+B* where R, G and B are the number of bits of resolutionof the red, green and blue components of the colors displayed on themonitor. The default value is 3+2+3.-pixelwidth *integer*Sets the width (in bits) of a pixel. A pixel should be at leastR+G+B bits wide. The default value is 8.-memwidth *integer*Sets the width (in bits) of the memory word that contains one ormore pixels. The memory width should be at least as wide as thepixels. 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 isinterpreted as an octal number unless you precede it with an initial"0x" to indicate it is a hexadecimal address. The default value is0.-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 asfollows:.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 standardinput and is assumed to be in portable any-map format.-ofile *filename*Gives the name of the file where the XES-formatted hexadecimal datawill be stored. If -ofile is not used, then the hexadecimal data iswritten to the standard output.DIAGNOSTICSimg2xes will abort if it does not recognize the suffix of the inputimage file or if the following contraint is not met:R+G+B <= pixel width <= memory widthEXAMPLESFor the XSA Boards using the VGA generator circuit described inhttp://www.xess.com/appnotes/an-101204-vgagen.pdf, here are the commandsto convert a JPEG file and produce an 800 x 600 display with pixelwidths of 4, 8 and 16. (We will not explicitly set some options sincethe default settings will work in this case)perl img2xes.pl -depth 1+1+1 -pixelwidth 4 -ifile image.jpg -ofileimage.xesperl img2xes.pl -depth 3+2+3 -pixelwidth 8 -ifile image.jpg -ofileimage.xesperl img2xes.pl -depth 3+3+3 -pixelwidth 16 -ifile image.jpg -ofileimage.xesTo 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 -ifileimage.png -ofile image.xesperl img2xes.pl -x 1024 -y 768 -depth 3+2+3 -pixelwidth 8 -ifileimage.png -ofile image.xesperl img2xes.pl -x 1024 -y 768 -depth 3+3+3 -pixelwidth 16 -ifileimage.png -ofile image.xesENVIRONMENTimg2xes requires a perl interpreter for its execution. You can get afree perl interpreter for Windows at www.activestate.com. You alreadyhave a perl interpreter if you are running linux, solaris or unix.img2xes requires the *netpbm* suite of image conversion programs inorder to convert the various image file formats. You can get these fromhttp://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.FILESNone.CAVEATSNone.BUGSPortable bitmap files (.pbm) are not handled, yet.RESTRICTIONSNone.NOTESimg2xes takes the red, green and blue component values of each pixel inthe image file and does the following:1. Each color component is truncated to the number of bits specifiedfor that component by the -depth option.2. The truncated color components are concatenated with the bluecomponent in the least-significant bit positions, the red componentin the most-significant bit positions, and the green component inbetween.3. The concatenated components are placed into the least-significantbit positions of a pixel field whose width is set using the-pixelwidth option. Any unused bits in the upper portion of thepixel field are set to zero.4. Pixel fields are concatenated until no more will fit into a memoryword 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 thememory word.5. The memory word is chopped into eight-bit bytes and output astwo-digit hexadecimal values starting with the most-significant byteand proceeding to the least-significant byte.SEE ALSOThe most-current version of img2xes.pl can be found athttp://wwww.xess.com/ho07000.html.AUTHORDave Vanden Bout, X Engineering Software Systems Corp.Send bug reports to bugs@xess.com.COPYRIGHT AND LICENSECopyright 2004 by X Engineering Software Systems Corporation.This library is free software; you may redistribute it and/or modify itunder the same terms as Perl itself.HISTORY10/12/04 - Version 1.0
