home *** CD-ROM | disk | FTP | other *** search
/ TopWare 18: Liquid / Image.iso / liquid / top1057 / dyeworks.doc next >
Encoding:
Text File  |  1994-03-24  |  16.7 KB  |  427 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.        DYEWORKS Version 1.31 - Color Reduction/Promotion/Manipulation
  11.        =============================================================
  12.  
  13.        The author's address:
  14.  
  15.               Stefan Reich
  16.               Bjoernsonweg 12e
  17.               22587 Hamburg
  18.               Germany
  19.               Tel/Fax: 0049 40 86 31 62 (if you happen to speak German)
  20.               CIS: [100117,1415]
  21.  
  22.        "Dyeworks 1.31" software is freely distributable as long as this
  23.        document accompanies the executable DYEWORKS.EXE and both files
  24.        remain unchanged. However, the program may not be included in a
  25.        commercial product without written permission from the author.
  26.        The GIF encoder/decoder implemented in Dyeworks 1.31 is based on
  27.        C routines from "Fractint" which are copyrighted (c) 1987 by
  28.        Steven A. Bennett.
  29.  
  30.  
  31.        What is it?
  32.        -----------
  33.  
  34.        Dyeworks
  35.        - reads and writes GIF, PCX, Targa, BMP and POV-Ray (DKBTrace)
  36.           dump format
  37.        - converts between color depths: grayscale, 256 colors, HiColor,
  38.           TrueColor 24, TrueColor 32
  39.        - reduces true color bitmaps to VGA-suited 256 colors or to any
  40.           given number of colors
  41.        - shrinks pictures with anti-aliasing; adjusts contrast,
  42.           brightness and gamma
  43.        - is F A S T!
  44.        - offers a variety of dithering processes for optimal results
  45.        - requires (almost) constant amounts of memory and time,
  46.           regardless of image size and contents
  47.          (well, ok, time is size-depending)
  48.  
  49.  
  50.        How you use it
  51.        --------------
  52.  
  53.        Dyeworks is batch-driven. That is, all parameters needed are
  54.        supplied on the DOS command line. This makes it possible to
  55.        process many files in a row without further user interaction.
  56.  
  57.        The usage is:
  58.  
  59.                DYEWORKS <option> <option> <option> ...
  60.  
  61.        Options are:
  62.  
  63.        *General Options
  64.  
  65.        -h,-? or no option
  66.        Displays a help screen showing available options.
  67.  
  68.        -i<file>
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.        Specifies the input file. Currently supported are CompuServe's
  77.        Graphics Interchange Format (GIF), PC Paintbrush (PCX), Targa,
  78.        Windows Bitmap (BMP) and POV-Ray dump format.
  79.  
  80.        Syntax 1: -o<file>
  81.        Syntax 2: -o(type)<file>
  82.        Specifies the output file. Its file type may be different from
  83.        the input file's type; if necessary, conversion is done.
  84.        If no output file is given, Dyeworks just reads and displays.
  85.        *Input and output file may not be identical!*
  86.  
  87.        File types:
  88.  
  89.        (g)  Grayscale        (8 Bits)
  90.        (8)  256 color palette (out of 256K colors)
  91.        (16) HiColor          (3*5 Bits)
  92.        (24) TrueColor        (3*8 Bits)
  93.        (32) TrueColor+Alpha  (3*8+8 Bits)
  94.  
  95.        Note: "Alpha" is an 8 bit wide field to store additional
  96.        information for each pixel (e.g. a transparency value). Dyeworks
  97.        ignores it when reading. When writing, all alpha values are set
  98.        to zero.
  99.  
  100.        These are all the possible combinations of file types and
  101.        formats (R=readable, W=writable, Default=default output file
  102.        type when none is specified):
  103.  
  104.                            (g)    (8)   (16)   (24)   (32)   Default
  105.        TGA Uncompressed    RW     RW     RW     RW     RW     (24)
  106.        TGA Compressed      R      R             R      R
  107.        GIF87a                     RW                           (8)
  108.        GIF89a                     R
  109.        PCX                        RW            RW             (8)
  110.        BMP Uncompressed    R      R      R      R      R
  111.        DIS (POV-Ray)                            RW            (24)
  112.  
  113.        Another note: The GIF encoder attaches greater weight to speed
  114.        than to compression efficiency. In other words, there are
  115.        programs that make GIFs around 1% smaller than Dyeworks does;
  116.        however, there is no program that produces GIFs as fast as
  117.        Dyeworks does (as far as I know).
  118.  
  119.        *Wildcards*
  120.  
  121.        Both input and output file name may contain wildcards. The input
  122.        file name follows the usual DOS wildcard conventions (allowing
  123.        '?' and '*'). Dyeworks will process all files that match the
  124.        input file name. If an output file name with wildcards is given,
  125.        it will be used as a mask to convert the name of the current
  126.        input file. Here, extended wildcards are allowed:
  127.  
  128.        Modifier   Function
  129.        ----------------------------------------
  130.            ?      copy one character             \
  131.            *      copy all remaining characters  | as understood by DOS
  132.            a      replace one character with 'a' /
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.            #      delete one character           \ unique to
  141.            ^a     insert character 'a'           / Dyeworks
  142.  
  143.        See examples.
  144.  
  145.        +o
  146.        Tells Dyeworks to <o>verwrite the output file(s) in case it/they
  147.        already exist(s). Without this option, Dyeworks will not change
  148.        an existing file.
  149.  
  150.        +d (the default)
  151.        Displays picture while converting, in case the following
  152.        conditions are met:
  153.        - a VGA adapter is detected,
  154.        - the picture is less or equal to 320 (width) * 200 (height)
  155.          pixels in size (no SVGA support so far, sorry), and
  156.        - there is no output file or it is of format '256 colors'.
  157.        As soon as the picture is complete, Dyeworks waits for a key to
  158.        be pressed. So if you want to convert multiple files
  159.        continuously, make sure to specify "-d"!
  160.  
  161.        -d
  162.        Disables graphical display.
  163.  
  164.        +q (quiet mode)
  165.        Disables text display. This option does NOT imply "-d".
  166.  
  167.        *Histograms*
  168.  
  169.        Syntax 1: -hn<file>   (New histogram file)
  170.        Syntax 2: -ha<file>   (Add histogram to file)
  171.  
  172.        These options scan the image and build up a histogram that
  173.        stores detailed information about the colors used in the image;
  174.        then, the histogram is saved into a file. "-hn<file>" starts
  175.        with an empty histogram; "-ha<file>" reads the histogram from
  176.        the file (that must exist), adds the new colors to it, and saves
  177.        it again.
  178.        You need such an on-disk-histogram when a palette is supposed to
  179.        fit multiple images. In this case, you would first scan all the
  180.        images with "-ha<file>", then convert the pictures down to 256
  181.        colors using "-hr<file>".
  182.  
  183.  
  184.        *True color manipulations
  185.  
  186.        Any image data read by Dyeworks (regardless of the format) is
  187.        first converted into true color. Now the manipulations listed
  188.        below may be executed. The last step is either saving the true
  189.        color data, or creating a palette for 256 color output.
  190.  
  191.        -s<factor> (factor=1-100)
  192.        Shrinks the picture isometrically:
  193.  
  194.            new width = old width / factor
  195.            new height = old height / factor
  196.  
  197.        The shrinking process doesn't just remove pixels from the
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.        picture: any program could give you that! No, it performs anti-
  206.        aliasing by averaging each square that will be deflated to one
  207.        pixel of the final image.
  208.        One application of this feature is to receive a kind of anti-
  209.        aliasing different from the one POV-Ray does, in terms of
  210.        smoothing without introducing noise. To obtain this effect,
  211.        render a picture at, let's say, 1280x800, and shrink it down to
  212.        320x200. I know, it's an immense size, and you will especially
  213.        get problems with your hard disk space (if you don't use
  214.        SuperStor(TM) :-). For the start, you could try a resolution of
  215.        640x400. Rendering this will take a time comparable to that a
  216.        320x200 raytracing with "anti-alias"-option on would need.
  217.        This option is also very useful for postprocessing the output of
  218.        (handy) scanners. Here, shrinking
  219.        a) anti-aliases, and
  220.        b) reduces irregularities of scanner and scanned image
  221.           (e.g., the moirĂ© effect occuring when scanning an image that
  222.           was printed with a halftone pattern).
  223.  
  224.        +m
  225.        Mirrors picture = swaps left and right.
  226.  
  227.        +vd +vc
  228.        These options concern the reduction from the 16 Million color
  229.        range (e.g.) POV-Ray produces to the 256 thousand color range a
  230.        (standard) VGA adapter supports. This operation is supposed to
  231.        precede a VGA palette creation, but in the first step leaves a
  232.        true color image that could be saved as well (but who would want
  233.        to do so?). Anyway, here is how it works:
  234.        The option "+vc" simply cuts off the two least significant bits.
  235.        (A little bit of computer math: 16 Million = 3*8 Bits; 262,144 =
  236.        3*6 Bits.) To cut a long story short: "+vc" is bad for
  237.        gradients, but good for large areas of constant color, because
  238.        it prevents "-pd" dithering (if turned on) from trying to dither
  239.        a color a VGA card just isn't able to display.
  240.        "+vd" cuts off two bits also, but remembers the "error" it makes
  241.        by doing so, in order to correct this error with the next pixels
  242.        processed. (You have guessed it: This is known as "dithering"
  243.        :-)
  244.        Using "+vd" together with "-pd" (s.b., together they're
  245.        "DoubleDither") gives you the smoothest gradients you've ever
  246.        seen. Try it: Render POV-Ray's "LAMP.POV" (this will take some
  247.        hours), and display the output using Dyeworks (this will take
  248.        some seconds).
  249.  
  250.        Note: With HiColor output, there will be a reduction from 16
  251.        Million to 32,768 (rather than 262,144) colors. Apart from this
  252.        difference, the above said applies.
  253.  
  254.        -v (default)
  255.        No color range reduction takes place.
  256.        This can mean several things:
  257.        - The true color picture remains unchanged.
  258.        - If "-pd" option is turned on, it will do all the dithering
  259.        work - AFTER the palette is chosen. One reason for the
  260.        superiority of DoubleDither is the fact that palette creation
  261.        takes place when most (or all) of the dithering work is already
  262.        done. This makes it possible to design a palette more closely
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.        aligned to the picture's real needs.
  271.        - If "-pn" is turned on, the effect will be a cut-off similar to
  272.        the one "+vc" would do. The same thing happens in case of a
  273.        HiColor output.
  274.  
  275.  
  276.        *256 color output (and/or display)
  277.  
  278.        Syntax 1: -c<colors>
  279.        Syntax 2: -c<firstentry>,<colors>  (default: -c1,256)
  280.        Sets the maximum number of output colors. For example, if you
  281.        say "-c100", at least 156 palette entries will be left blank.
  282.        By the way, the palette will always be sorted by descending
  283.        frequency. (In other words: most popular colors first, least
  284.        popular colors last.) Thus, if a (Windows) graphics software
  285.        cuts off the last 16 or 20 entries it needs for itself, it won't
  286.        do much harm.
  287.        <firstentry> specifies the first palette entry to use (1-256).
  288.  
  289.        -pd -pl -pn (default: -pd)
  290.        These options influence the way the original picture's colors
  291.        are assigned to the new palette.
  292.        -pn seeks the "nearest" available color (in the RGB cube).
  293.        -pd does so, too, but superposes a full dither that does not
  294.        "forget" any error it has made (see "-pd" section above).
  295.        -pl dithers also, but in a much more "sloppy" way. Only great
  296.        errors will affect other pixels.
  297.  
  298.        -e<max> (1-256, default: -e12)
  299.        Limits the error that is saved and transported. This prevents
  300.        "-pd" dithering from making bad things worse: e.g., if a much
  301.        too bright color had to be chosen, the next pixel would be much
  302.        too dark instead in order to correct the error made. (Usually,
  303.        this doesn't occur unless you limit the number of colors
  304.        (s.a.).) "-e12" means that any error beyond a distance of 12
  305.        true color shades (=3 VGA shades, or three 64ths of the distance
  306.        between black and white) will be ignored.
  307.  
  308.        -hr<file>
  309.        Reads the histogram from a file, rather than building a
  310.        histogram from the image read. See "Histograms" section above.
  311.  
  312.  
  313.        Examples
  314.        --------
  315.  
  316.        C:>dyeworks -inicepic
  317.        Standard command to display true color pictures ("nicepic.tga"
  318.        in this case). Palette creation; single dither; no output file.
  319.  
  320.        C:>dyeworks -ilamp -olamp
  321.        Reads "lamp.tga", creates a palette, dithers, displays if
  322.        possible, and saves to "lamp.gif".
  323.  
  324.        C:>dyeworks -ibigpic.dis -s5 -o(16)smallpic.tga
  325.        Reads "bigpic.dis", shrinks it to a fifth (or a twentyfifth of
  326.        its surface), converts down to HiColor (without dithering), and
  327.        writes to "smallpic.tga". Displaying is not possible since no
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.        palette is generated.
  336.  
  337.        C:>for %p in (pic1 pic2 pic3) do dyeworks -i%p.dis -o%p.pcx +vd
  338.        -d -q
  339.        This call uses DOS "for" command to process three images in a
  340.        row. "pic1.dis", "pic2.dis" and "pic3.dis" will be converted to
  341.        "pic1.pcx", "pic2.pcx" and "pic3.pcx", respectively.
  342.        DoubleDither is turned on. Text and graphic display are
  343.        disabled.
  344.        In a batch file, the line would look slightly different:
  345.        for %%p in (pic1 pic2 pic3) do dyeworks -i%%p.dis -o%%p.pcx +vd
  346.        -d -q
  347.  
  348.        C:>dyeworks -ianim*.dis -o^_*.gif +vd -d -q
  349.        Converts all POV-Ray dump files beginning "anim" in the current
  350.        directory to files with "_" inserted at the front and GIF
  351.        extension. For example, "anim001.dis" would be converted to
  352.        "_anim001.gif".
  353.  
  354.        C:>dyeworks -imanycols.gif -c128 -olesscols.gif
  355.        Reads "manycols.gif", creates a new palette with up to 128
  356.        colors, and writes to "lesscols.gif". Note that if reading a 256
  357.        color file with no shrinking applied, "+vd" and "+vc" options
  358.        are ignored since color range already is 262,144.
  359.  
  360.  
  361.        Error Levels
  362.        ------------
  363.  
  364.        Dyeworks returns an error level depending on successful
  365.        completion or occurrence of errors. The error level can be
  366.        checked using DOS "if errorlevel" command. See MS-DOS user's
  367.        guide for details.
  368.        These are the codes:
  369.  
  370.         0  No Error
  371.         1  Help screen displayed
  372.         2  Could not understand command line
  373.         3  Out of memory
  374.         4  Input file is corrupt or does not exist
  375.         5  Could not write output file (bad directory, disk full?)
  376.         6  (At least one) output file exists, skipped
  377.         7  Histogram overflow
  378.  
  379.  
  380.        Warranty
  381.        --------
  382.  
  383.        I, the author, hereby guarantee that Dyeworks is the cheapest,
  384.        fastest and best VGA color reduction utility available. However,
  385.        if you find a program that produces better results in shorter
  386.        time, you will get your money back. Contact me, and I will send
  387.        you a cheque for 0.00 US-$ (or, if you like, 0.00 UK pounds, 0
  388.        Yen or any other currency :-). Joking apart, contact me, and I
  389.        will see what I can do for Dyeworks 2.0. If you want to include
  390.        Dyeworks in a commercial software or package: contact me also.
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.        Design Limits
  400.        -------------
  401.  
  402.        Minimum operating system:             MS-DOS 3.0
  403.        Minimum processor:                    80286 (Pentium is OK, too)
  404.        Minimum free DOS memory:              400,000-540,000 Bytes
  405.                                  (the latter may apply for GIF encoding)
  406.        Minimum graphics adapter for display: VGA
  407.        Maximum bitmap size before shrinking: 20480*infinite
  408.        Maximum bitmap size after shrinking:  1280*infinite
  409.                          (1280*1024 is guaranteed to fit into histogram)
  410.  
  411.  
  412.        Revision History (major versions only)
  413.        ----------------
  414.  
  415.        1.31 Bugfix, accelerations
  416.  
  417.        1.3  Multi-file (wildcard) support; histogram sharing
  418.             New effects (contrast, brightness, gamma)
  419.             New formats (Targa Compressed, BMP; HiColor, Grayscale)
  420.             EMS support for caching purposes
  421.             ...and various speed improvements
  422.  
  423.        1.2  Final GIF encoder/decoder: fast & stable
  424.  
  425.        1.0  First version; distributed in CompuServe's Graphics
  426.             Developers+ Forum
  427.  
  428.        Final note: There is a Protected Mode (DPMI) version of Dyeworks
  429.        available that consumes 400-600K of extended memory and very
  430.        little DOS memory (very useful when calling Dyeworks as a child
  431.        process). Contact me if you want to have it. I was not sure
  432.        whether anyone could need a DPMI Dyeworks, and considered the
  433.        package including both versions a bit too large to upload it in
  434.        CompuServe.
  435.  
  436.        Have fun!