File: FIXPAL.TXT | Size: 9,144 bytes | Download file | Back to directory listing | BWPOW's homepage
              ΫΫΫΫΫ»  ΫΫ»           ΫΫΫΫ»            ΫΫΫ»
              ΫΫΙΝΝΌ  ΘΝΌ           ΫΫΙΝΫΫ»           ΫΫΊ
              ΫΫΫΫ»   ΫΫ»  ΫΫ» ΫΫ»  ΫΫΫΫΙΝΌ  ΫΫΫΫ»    ΫΫΊ
              ΫΫΙΝΌ   ΫΫΊ  ΘΝΫΫΙΝΌ  ΫΫΙΝΌ    άάΫΫΊ    ΫΫΊ
              ΫΫΊ     ΫΫΊ  ΫΫΙΝΫΫ»  ΫΫΊ      ΫάΫΫΫ»  ΫΫΫΫ»
              ΘΝΌ     ΘΝΌ  ΘΝΌ ΘΝΌ  ΘΝΌ      ΘΝΝΝΝΌ  ΘΝΝΝΌ  Version 2.9

                       created by Marian Dvorsky

  1. Introduction
  ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ

  Sometimes you need to use many bitmaps in your programs. But they can
  have different palette. And when you put them on a screen, you don't know
  which palette you have to use. (you can use only one 256 color palette)
  So, they all can't have right colors.

  With this program, you can solve this problem.

  2. Are there any limits?
  ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ

  Yes, of course. We are still talking about 256 (8 bit) colors. So all
  bitmaps must have together just 256 colors (all same or similar colors are
  in palette just once) (for 16, 24 or 32 bit, you don't need palette
  i think).

  For g method - all files must have together 65535 used colors.

  Sure, they can have more than 256 (for s method) or 64k (for g method) colors,
  but they will be ignored.

  3. How this program really works?
  ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ

  First of all, you must have common palette - the same palette for all
  your bitmap, which you want to have on screen at once. You can create
  this common palette "by hand", or leave it to FixPal. If you will leave
  to FixPal, you have two options:
     - sequential or guess method (default).
  Guess method produces better results but it's a little bit slower.

  Sequential search
  ΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔ
    This method reads input files and saves all used colors. All same
  (or similar, when using color tolerance) color is saved only once. That is
  why is it called sequential - it reads pixel by pixel and saving it's
  color. If that (or similar) color is already in common palette, it don't
  puts it there, otherwise it's saved to common palette. When 255 (or value
  specified with -m) colors are currenly in common palette, palette reading
  will exit.
    Accepted color tolerance (-s parameter) values are from 0 to 255
  (255 is maximum tolerance - there will be only one color).
    Transparent color is by default all colors with rgb 0,0,0, not color 0.
  (but you can set it with -T or -t parameter).

  Guess method
  ΔΔΔΔΔΔΔΔΔΔΔΔ
    If you don't want to bother with things like color tolerance, etc. you
  can leave all work on this guess method. It will read all palettes of all
  files and then choose the most different colors. This method produces
  good results I think, so I recommend to try it first.

  Custom
  ΔΔΔΔΔΔ
    If you don't want FixPal to create common palette you can specify your
  common palette which will be used.
    You can create this input palette with palette editor (Run fixpal.exe
  with 'e' command. See editpal.txt for details)


    After creating common palette with one of previous methods this program
  reads all input files again and replaces original color vaules of original
  palette with new ones with "which new color in common palette fits best"
  method. (this step is omited when you use -p parameter)

    To get the best result you could try all methods combining with
  different finding best color method algorithm. (-f parameter)

  When processing true/hicolor images you have two options. The first
  (default) is VERY slow but produces good results. FixPal works with
  hi/truecolor files like every other 256 color file (that means to go
  pixel by pixel, saving different colors and then remapping in new
  palette). Second option is to use -r parameter. FixPal then reduce
  true/hicolor image to 256 color image first and after THAT does the other
  things. (like saving colors, etc.) This is a LOT faster but not always
  does the best.


  4. Which files can you use?
  ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ

  If you specify output palette file, then it can be TGA, PCX or BMP file
  (can be used with grabber). Input files can be TGA, PCX or BMP 8,15,16,24
  or 32 bit color files.

  You can use filelists as parameter. Filelists are text files with one file
  (not wildcard) per line. Add char '@' before filelist filename. See example
  few lines below.

  5. How to use this program?
  ΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ

  Syntax: fixpal.exe [method] infile [infile [infile]...] [options]

            method - method you want to use:
                        s - Sequential search
                        g - Guess method (default)
                        c - remap to specified Custom palette
            infile - graphic file(s) in format tga,pcx,bmp
                     (use wildcard, ie. *.bmp, or filelist (add '@' before
                     filelist name))

  Options:
           -pfilename : saves palette ONLY to specified file
           -mcol : set max number of colors in palette
           -fx : finding best color method
                    a - my method
                    b - method by Shawn Hargreaves
           -tr,g,b : set rgb structure of original transparent color
           -ntr,g,b : set rgb structure of new transparent color
           -llogfile : creates logfile
           -r : reduce hi/truecolor files to 8 bit before processing
           for method s
             -Tc : set original transparent color (can't combine with -t)
             -sc : set color tolerance (0-255)
           for method c
             -ifilename : re-map bitmaps' color to palette in this file

  Example: fixpal.exe s *.bmp *.tga bitmap.pcx @myfiles.txt -ppaleta.tga -s10

  6. Changes
  ΝΝΝΝΝΝΝΝΝΝ

  == Version 2.9 ==
   - released as open-source

  == Version 2.8a ==
   - fixed very ugly bug in 'c' method

  == Version 2.8 ==
   - editpal improved (added cut, copy, paste, insert, gradient and inverse)

  == Version 2.7 ==
   - few bugfixes in editpal
   - method is now optional (default method is g)
   - when you use -p parameter it will not remap colors to new palette
   - when reading palettes from 8 bit files, it scales r,g,b to fit in
     range (0-255) not (0-63) - that was done because of hi/truecolor files
   - because of previous fix, color tolerance accepted values are from 0-255
     and in -t and -nt parameters you have to use 0-255 for r,g,b
   - added -l parameter to save logfile. Maybe I will save some useful
     information there in future. ;)
   - added -r parameter - with this parameter turned on you will get same
     results with true/hicolor images as in previous version

  == Version 2.6 ==
   - improved guess method - now it produce better results - try it!
   - improved speed
   - new parameter -d - use it, if you want fixpal only create common
     palette
   - hi/truecolor input files supported (and tested)
   - changed my "bestfit" algorithm to 3d color distance
   - added filelist support
   - minor bugfixes

  == Version 2.5 ==
   - fixed bug in specifing file with directory name
   - new method for creating common palette
   - ready to add new "best fit" algorithms
   - improved palette editor (hope you'll like it)

  == Version 2.1 ==

   - fixed bug in editpal, which didn't saves palette changes
   - there was repaired an error, so when you didn't use -i parameter you
     didn't get right colors
   - fixed bug in parameters reading
   - you can now enter more than one wildcard/file

  == Version 2.0 ==
   - added PALETTE EDITOR (see editpal.txt for detials)
   - added PCX and BMP support
   - better algorithm for finding the most similar color
   - you can now specify your own common palette and
     all bitmaps' colors will be re-maped in it (very useful, though)

  == Version 1.5 beta ==
   - setable max number of colors
   - better transparent color support
   - color tolerance

  == Version 1.0 - first official release ==
   - added Allegro support
   - now it recognize same colors
   - many, many changes

  7. Future
  ΝΝΝΝΝΝΝΝΝ

  I want append following in next release:

    - FixPal Graphical interface
    - Windows version

  8. Copyleft
  ΝΝΝΝΝΝΝΝΝΝΝ

  This program is open-source and is provided as is. You can make anything
  with this code. I offer no support for it and I don't guarantee it will
  work, or it will even compile. It uses
  liballeg (Allegro - http://www.talula.demon.co.uk/allegro) and 
  libbgui  (http://www.concentric.net/~Skis/bgui.html)
  so don't try to compile without it.

  9. Thanks list
  ΝΝΝΝΝΝΝΝΝΝΝΝΝΝ

  Thanks goes to all who made Allegro, the best free graphic library for
  DJGPP out there. (http://www.talula.demon.co.uk/allegro)

  I want also thank to Grzegorz Adam Hankiewicz, who helps me with testing
  FixPal.

  10. Contact
  ΝΝΝΝΝΝΝΝΝΝΝ

  Any comments? Suggestions? Questions? Write them to my e-mail:
  marian@step.sk.

  For newest version go to http://www.step.sk/marian/fixpal.htm