[Zope] ANN: VarImage 2.3.2 Released

Terry Hancock hancock at anansispaceworks.com
Thu Jun 17 23:56:51 EDT 2004


Version 2.3.2 includes the large cache-optimization patch
written by Eric Pollman which reportedly can improve
performance by 10X or more in certain test conditions.

I have tested it on Zope 2.5.1 and Zope 2.6.4 (on FreeBSD
and Debian Linux platforms, respectively), but it probably
works on later Zopes and any platform on which PIL is
available.

This also fixes a bug with handling width and height
attributes, should they be set to strings instead of ints,
which avoids some annoying editing problems.

Get it from the Narya project at SourceForge:

http://sourceforge.net/projects/narya-project

Cheers,
Terry


From the README.txt file:

VarImage 2.3
 
  VarImage means "variable image".  It provides a way to make
  on-the-fly modifications to an image in Zope simply by referring
  to the correct URL.

  [...]
 
Syntax
 
  The URL-command is parsed as a chain of "operations" to be applied
  to the original image, separated by "." (period).  Each operation
  is specified as an "operator", followed by zero or more "arguments",
  separated by "_".
 
  Arguments and operators must be composed of only letters and numbers
  ([A-Za-z0-9], note that "_" and "." are not legal because they are
  used as separators). Other than the fact that floating point values
  have to use "o" (the letter "o") instead of "." for the decimal
  point, this works well.
 
  Colors are represented by strings, usually as hexadecimal codes, with
  a prefix of "x" and 6 hexadecimal characters.
 
  Component images may be referred to by their unadorned Zope ID, so
  "myimage/components/mycomponent" is simply "mycomponent".  Note
  that, to be useful, you have to use only letters and numbers in
  the name of components.
   
  Each operation is applied in sequence, to the result of the previous
  operation, and then the final result is returned.
 
Examples
 
  If you have a VarImage "shinobu_jpg", you can get it
  in an exact size of 100x100 (regardless of the original aspect)::
 
    shinobu_jpg/s_100
  
  or 100x50::
 
    shinobu_jpg/s_100_50
 
  or you can thumbnail it into a 70x50 space (the longer dimension
  will be determined by the specified limit, while the smaller is
  determine by the image aspect ratio -- i.e. the image will "fit"
  into the available 70x50 space)::
 
    shinobu_jpg/f_70_50
 
  or you can set the horizontal or vertical dimensions::
 
    shinobu_jpg/h_85
    shinobu_jpg/v_100
 
  (The above examples are converted from the Version 1 docs).
 
  You can also convert the image to PNG or GIF format::
 
    shinobu_jpg/tn_100.png
    shinobu_jpg/tn_100_200.gif
 
  And do color effects, such as black-and-white::
 
    shinobu_jpg/bw
 
  or color-multiplication::
 
    shinobu_jpg/mult_x0e5f00.png
    shinobu_jpg/bw.R.gif
 
Special Commands
 
  For a help page with a complete list of all currently understood
  operators, use::
 
    shinobu_jpg/help
 
  If you need to clear the cache and start over for some reason (this
  is necessary a lot when you're writing a new plugin)::
 
    shinobu_jpg/clear_cache
 
  [...]

How It Works
 
  VarImage inherits from Zope's Image and ObjectManager types, so
  it is an image that also acts as a folder. The folder contains
  a Temporary Folder named "cache". When you query for a modified
  image, it first checks to see if the cache already contains the
  image. If so, it returns that. Otherwise, it uses Python Imaging
  Library to generate the image, and stores the result in the
  cache.
   
  [...]
 
Writing Plugins
 
  It is now trivial to add a plugin operator to VarImage, and you
  do not need any understanding of Zope to do this. You will need
  to understand how to manipulate and process images in Python.
 
  [...]
 
Author and Licensing
 
  Terry Hancock wrote VarImage for Anansi Spaceworks. It may be
  redistributed under the terms of the Gnu Public License. The
  full text of the GPL is in the file LICENSE.txt in this
  distribution.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Zope mailing list