Selecting an Image FormatA function make_image() is provided in $UNIDIR/lib/libhtml.gsl. If you want to modify this or to use your own routine, then the following information will be useful. Selecting a DeviceThe output image format is set in GSL using the property hardcopy.XuNdevice. It must be set to the name of a token representing the output device. harcopy.XuNdevice = "ggifl8"; The list of tokens for web-compliant image formats, are listed in the tables below. Declaring a DeviceAny devices you wish to use should be declared in the Gsharp startup file $UNIDIR/base/Gsharprc.gsl or in the user startup file $HOME/.Gsharprc.gsl. The devices in bold below are included by default. The built-in function define_device() is used to declare devices. define_device(string token, string description, pagesize,x,y,orien,string default_filename);For image devices, such as GIF and JPEF, pagesize,x,y,orien should be set to 0,,,, So to create an image using "SJPGI8 - RGB Intensity Device", add the following call to $UNIDIR/base/Gsharprc.gsl: define_device("sjpgi8","JPEG (RGB)",0,,,,"gsharp.jpg",);You can now create the image like so: hardcopy.XuNdevice = "sjpgi8"; print; Image sizeThe size of the image that is created is based on the size of your page. Each device has a different number of pixels for each mm of the page. Each driver includes one device which has 1 pixel for 1 mm of the page - this is the token without the H,M or L suffix. This device is used by default. To create a GIF, px pixels by py pixels, use the following commands: hardcopy.XuNdevice = "ggifl8"; page_1.XuNsize = (px,py), print; File namesThe property hardcopy.XuNfilename is used to specify the name of the image. e.g. hardcopy.XuNfilename = "myplot.gif"; GIF ImagesGIF is an 8bpp format with up to 256 colors. The device tokens for GIF are listed below. GGIFL8 CMY Lookup Device 1 d.p.mm GGIFL8H CMY Lookup Device 300 d.p.i GGIFL8M CMY Lookup Device 150 d.p.i GGIFL8L CMY Lookup Device 75 d.p.i SGIFL8 RGB Lookup Device 1 d.p.mm SGIFL8H RGB Lookup Device 300 d.p.i SGIFL8M RGB Lookup Device 150 d.p.i SGIFL8L RGB Lookup Device 75 d.p.iThe GIF image format contains a patented compression algorithm which Advanced Visual Systems has licensed from UNISYS. According to this contract, users of the Gsharp Web Edition are allowed to use GIF driver driver under the following conditions: "A portion of this product is licensed under U.S. Patent No. 4,558,302 and foreign counterparts. You may only use this product on the personal computer or workstation for which you have obtained a licensed from the products vender. If you will be using PDF and/or TIFF -LZW and/or GIF and/or PostScript Interpreter and/or proprietary LZW graphics capability, You are prohibited from publishing, distributing, disclosing, modifying or copying the software (except that an end user may make one copy for archival or backup purposes)." If you have any questions regarding the terms of the Advanced Visual
Systems GIF license, please contact Advanced Visual Systems.
JPEG is a 24 bbp image format supporting high data compression. The high data compression is due, in part, to the fact that a "lossy" compression algorithm is used, resulting in lost pixels. To minimize pixel loss, the Gsharp driver uses the highest image quality, lowest data compression possible. Despite this, pixel loss is still noticeable around image lines and text, which appear to have pixel "clouds" around them. For this reason JPEG is not particularly well suited to vector graphics. Gsharp PNG and GIF image output will provide higher data compression and better image quality. Gsharp JPEG uses 24 bbp, resulting in up to 256**3 colors. The device tokens for JPEG are listed below. GJPGI8 CMY Intensity Device 1 d.p.mm GJPGI8H CMY Intensity Device 300 d.p.i GJPGI8M CMY Intensity Device 150 d.p.i GJPGI8L CMY Intensity Device 75 d.p.i SJPGI8 RGB Intensity Device 1 d.p.mm SJPGI8H RGB Intensity Device 300 d.p.i SJPGI8M RGB Intensity Device 150 d.p.i SJPGI8L RGB Intensity Device 75 d.p.i PNG ImagesPNG, "Portable Network Graphics", is an image format designed specifically for the Web. PNG is a true color format supporting up to 48 bbp. Gsharp uses 8 bbp, resulting in up to 256 colors. The device tokens for PNG are listed below. GPNGL8 CMY Lookup Device 1 d.p.mm GPNGI8 CMY Intensity Device 1 d.p.mm GPNGL8H CMY Lookup Device 300 d.p.i GPNGI8H CMY Intensity Device 300 d.p.i GPNGL8M CMY Lookup Device 150 d.p.i GPNGI8M CMY Intensity Device 150 d.p.i GPNGL8L CMY Lookup Device 75 d.p.i GPNGI8L CMY Intensity Device 75 d.p.i SPNGL8 RGB Lookup Device 1 d.p.mm SPNGI8 RGB Intensity Device 1 d.p.mm SPNGL8H RGB Lookup Device 300 d.p.i SPNGI8H RGB Intensity Device 300 d.p.i SPNGL8M RGB Lookup Device 150 d.p.i SPNGI8M RGB Intensity Device 150 d.p.i SPNGL8L RGB Lookup Device 75 d.p.i SPNGI8L RGB Intensity Device 75 d.p.i Java Outputljava Java Draw Method Driver |