home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Der Mediaplex Sampler - Die 6 von Plex
/
6_v_plex.zip
/
6_v_plex
/
DISK2
/
MULTI_04
/
DYEWOR.ZIP
/
DYEWORKS.DOC
next >
Wrap
Text File
|
1993-08-19
|
12KB
|
307 lines
DYEWORKS Version 1.01 - VGA Color Reduction
===========================================
The author's address:
Stefan Reich
Bjoernsonweg 12e
22587 Hamburg
Germany
Tel: 0049 40 86 31 62 (if you happen to speak German)
CIS: [100117,1415]
"Dyeworks 1.01" software is freely distributable as long as this
document accompanies the executable DYEWORKS.EXE. However, the
program may not be included in a commercial product without
written permission from the author.
What is it?
-----------
Dyeworks
- reduces true color bitmaps to VGA-suited 256 colors or to any
given number of colors
- shrinks pictures with anti-aliasing
- is F A S T!
- offers a variety of dithering processes for optimal results
- reads and writes PCX, Targa and DKBTrace (POV-Ray) dump format
- requires (almost) constant amounts of memory and time,
regardless of image size and contents
How you use it
--------------
Dyeworks is batch-driven. That is, all parameters needed are
supplied on the DOS command line. This makes it possible to
process many files in a row without further user interaction.
The usage is:
DYEWORKS <option> <option> <option> ...
Options are:
*General Options
-h,-? or no option
Displays a help screen showing available options.
-i<file>
Specifies the input file. Currently supported are PC Paintbrush
(PCX), Targa and DKB dump format. The file type also determines
the type of image data:
.TGA: Targa-24, 24 Bit True Color Uncompressed
.DIS: DKBTrace Dump, 24 Bit True Color Uncompressed
.PCX: PC Paintbrush, 256 Colors out of 256,000 (for VGA display)
-o<file>
Specifies the output file. Its file type may be different from
the input file's type; if necessary, conversion is done.
If no output file is given, Dyeworks just reads and displays.
*Input and output file may not be identical!*
+o
Tells Dyeworks to <o>verwrite the output file in case it already
exists. Without this option, Dyeworks will not change an
existing file.
+d (the default)
Displays picture while converting, in case the following
conditions are met:
- a VGA adapter is detected,
- the picture is less or equal to 320 (width) * 200 (height)
pixels in size (no SVGA support so far, sorry), and
- there is no output file or it is written in PCX format.
As soon as the picture is complete, Dyeworks waits for a key to
be pressed. So if you want to convert multiple files
continuously, make sure to specify "-d"!
-d
Disables graphical display.
+q (quiet mode)
Disables text display. This option does NOT imply "-d".
*True color manipulations
Any image data read by Dyeworks (regardless of the format) is
first converted into true color. Now the manipulations listed
below may be executed. The last step is either saving the true
color data into a Targa or dump file, or creating a palette for
PCX output.
-s<factor> (factor=1-100)
Shrinks the picture isometrically:
new width = old width / factor
new height = old height / factor
The shrinking process doesn't just remove pixels from the
picture: any program could give you that! No, it performs anti-
aliasing by averaging each square that will be deflated to one
pixel of the final image.
One application of this feature is to receive a kind of anti-
aliasing different from the one DKBTrace does, in terms of
smoothing without introducing noise. To obtain this effect,
render a picture at, let's say, 1280x800, and shrink it down to
320x200. I know, it's an immense size, and you will especially
get problems with your hard disk space (if you don't use
SuperStor(TM) :-). For the start, you could try a resolution of
640x400. Rendering this will take a time comparable to that a
320x200 raytracing with "anti-alias"-option on would need.
+m
Mirrors picture = swaps left and right.
+vd +vc
These options concern the reduction from the 16 Million color
range DKBTrace produces to the 256,000 color range a (standard)
VGA adapter supports. This operation is supposed to precede a
VGA palette creation, but in the first step leaves a true color
image that could be saved as well (but who would want to do
so?). Anyway, here is how it works:
The option "+vc" simply cuts off the two least significant bits.
(A little bit of computer math: 16 Million = 3*8 Bits; 256,000 =
3*6 Bits.) To cut a long story short: "+vc" is bad for
gradients, but good for large areas of constant color, because
it prevents "-pd" dithering (if turned on) from trying to dither
a color a VGA card just isn't able to display.
"+vd" cuts off two bits also, but remembers the "error" it makes
by doing so, in order to correct this error with the next pixels
processed. (You have guessed it: This is known as "dithering"
:-)
Using "+vd" together with "-pd" (s.b., together they're
"DoubleDither") gives you the smoothest gradients you've ever
seen. Try it: Render DKBTrace's "LAMP.DAT" (this will take some
hours), and display the output using Dyeworks (this will take
some seconds).
-v (default)
No color range reduction takes place.
This can mean several things:
- The true color picture remains unchanged.
- If "-pd" option is turned on, it will do all the dithering
work - AFTER the palette is chosen. One reason for the
superiority of DoubleDither is the fact that palette creation
takes place when most (or all) of the dithering work is already
done. This makes it possible to design a palette more closely
aligned to the picture's real needs.
- If "-pn" is turned on, the effect will be a cut-off similar to
the one "+vc" would do.
*PCX output
-c<colors> (default: -c256)
Sets the maximum number of output colors. For example, if you
say "-c100", at least 156 palette entries will be left blank.
By the way, the palette will always be sorted by descending
frequency. (In other words: most popular colors first, least
popular colors last.) Thus, if a Windows graphics software cuts
off the last 16 entries it needs for itself, it won't do much
harm.
-pd -pl -pn
These options influence the way the original picture's colors
are assigned to the new palette.
-pn seeks "nearest" available color (in the RGB cube).
-pd does so, too, but superposes a full dither that does not
"forget" any error it has made (see "-pd" section above).
-pl dithers also, but in a much more "sloppy" way. Only great
errors will affect other pixels.
-e<max> (1-256, default: -e12)
Limits the error that is saved and transported. This prevents
"-pd" dithering from making bad things worse: e.g., if a much
too bright color had to be chosen, the next pixel would be much
too dark instead in order to correct the error made. (Usually,
this won't occur unless you limit the number of colors (s.a.).)
"-e12" means that any error beyond a distance of 12 true color
shades (=3 VGA shades, or three 64ths of the distance between
black and white) will be ignored.
Examples
--------
C:>dyeworks -inicepic
Standard command to display true color pictures ("nicepic.tga"
in this case). Palette creation; single dither; no output file.
C:>dyeworks -ilamp -olamp
Reads "lamp.tga", creates a palette, dithers, displays if
possible, and saves to "lamp.pcx".
C:>dyeworks -ibigpic.dis -s4 -osmallpic.tga
Reads "bigpic.dis", shrinks it to a fourth, and writes to
"smallpic.tga". Displaying is not possible since no palette is
generated.
C:>for %p in (pic1 pic2 pic3) do dyeworks -i%p.dis -o%p.pcx +vd
-d -q
This call uses DOS "for" command to process three images in a
row. "pic1.dis", "pic2.dis" and "pic3.dis" will be converted to
"pic1.pcx", "pic2.pcx" and "pic3.pcx", respectively.
DoubleDither is turned on. Text and graphic display are
disabled.
In a batch file, the line would look slightly different:
for %%p in (pic1 pic2 pic3) do dyeworks -i%%p.dis -o%%p.pcx +vd
-d -q
C:>for %p in (anim*.dis) do dyeworks -i%p -o%p.pcx +vd -d -q
Converts all DKB dump files beginning "anim" in current
directory to files with same name but PCX extension. For
example, "anim001.dis" would be converted to "anim001.pcx". In
fact, in this case DOS would expand the command line like this:
C:>dyeworks -ianim001.dis -oanim001.dis.pcx +vd -d -q
To avoid problems with a filename containing two extensions,
Dyeworks automatically removes all but the last:
C:>dyeworks -ianim001.dis -oanim001.pcx +vd -d -q
C:>dyeworks -imanycols.pcx -c128 -olesscols.pcx
Reads "manycols.pcx", creates a new palette with up to 128
colors, and writes to "lesscols.pcx". Note that if reading a PCX
file with no shrinking applied, "+vd" and "+vc" options are
ignored since color range already is 256,000.
Error Levels
------------
Dyeworks returns an error level depending on successful
completion or occurrence of errors. The error level can be
checked using DOS "if errorlevel" command. See MS-DOS user's
guide.
These are the codes:
0 No Error
1 Help screen displayed
2 Could not understand command line
3 Out of memory
4 Input file is corrupt or does not exist
5 Could not write output file (bad directory, disk full?)
Warranty
--------
I, the author, hereby guarantee that Dyeworks is the cheapest,
fastest and best DKBTrace VGA postprocessor available. However,
if you find a program that produces better results in shorter
time, you will get your money back. Contact me, and I will send
you a cheque for 0.00 US-$ (or, if you like, 0.00 UK pounds, 0
Yen or any other currency :-). Joking apart, contact me, and I
will see what I can do for Dyeworks 2.0.
Design Limits
-------------
Minimum operating system: MS-DOS 3.0
Minimum processor: 80286 (Pentium is OK, too)
Minimum free DOS memory: 400,000-414,000 Bytes
Minimum graphics adapter for display: VGA
Maximum bitmap size before shrinking: 2048*76800
Maximum bitmap size after shrinking: 1024*768
Revision history
----------------
1.01 Released three days later
- PCX output sped up
- bugfix: +o option
(no "X.0" version is bug free (see OS/2 2.0)!!!!)
1.0 First version; distributed in CompuServe's Graphics
Developers+ Forum
Have fun!