"Bill" == Bill Janssen <[EMAIL PROTECTED]> writes:

Bill> Dirk, you'll want to look at what I've done in ImageParser.py.
Bill> I've defined a base class (ImageParser), and made pil2 and netpbm2
Bill> subclasses from that class.  Generic code moves into the base


A few comments:

- Do you wan't also the way to let the user specify the max_tbmp_size?
   config.get_int ('max_tbmp_size', SimpleImageMaxSize)

- The lines

              while len(newbits) > SimpleImageMaxSize:
                  old_target_size = target_size
                  target_size = 0.95 * target_size
                  scaling_factor = math.sqrt(float(target_size)/float(len(newbits)))
                  if self._verbose > 1:

  why do not write:
                  
              while len(newbits) > SimpleImageMaxSize:
                  old_target_size = target_size
                  target_size = SimpleImageMaxSize
                  scaling_factor = math.sqrt(float(target_size)/float(len(newbits)))
                  if self._verbose > 1:


  and get in in one go?


- If the try_reduce_bpp get no result (tbmp that small enough) the
  try_reduce_dimension are never tryed.
  
- There are many unnecessary convert steps. If there are no tbmp
  compression used the tbmp size could be calculated _without_
  converting the tbmp first. And even if the convert from bmp to tbmp
  are needed more than one time, the step to convert the jpg/gif/png to
  an bmp are need only once. Maybe we should sepperate the seps into:

  1. Call the first function that read the jpg/png/gif and return the
     size (width/height) and the PIL object _or_ if we do not use PIL the
     filename of the tempoary created BMP/PNG bitmap.

  2. If no tbmp compression are uses calculate the values and call the
     convert_to_tbmp once. If tbmp compression are used call the
     convert_to_tbmp function (with step by step reducion of bpp and
     size) until the site fit.

cu,
 Dirk

-- 
Permanent URLs to the latest Version (1.1.13) of the Plucker Windows installer
 - For the Webpage: http://www.dirk-heiser.de/plucker
 - Direct Download: http://www.dirk-heiser.de/plucker/plucker.exe [2.08MB]

Reply via email to