home *** CD-ROM | disk | FTP | other *** search
/ PC Extra 07 & 08 / pca1507.iso / Software / psp8 / Data1.cab / PaletteFromImage.PspScript < prev    next >
Encoding:
Text File  |  2003-04-22  |  2.0 KB  |  46 lines

  1. from JascApp import *
  2. import JascUtils
  3. import os.path
  4.  
  5. def ScriptProperties():
  6.     return {
  7.         'Author': 'Joe Fromm',
  8.         'Copyright': 'Copyright (C) 2002-2003, Jasc Software Inc., All Rights Reserved. Permission to create derivate works of this script is granted provided this copyright notice is included',
  9.         'Description': 'Create a palette from the open image.  The user is prompted for the number of colors to use.',
  10.         'Host': 'Paint Shop Pro',
  11.         'Host Version': '8.00'
  12.         }
  13.  
  14. def Do(Environment):
  15.     if JascUtils.RequireADoc( Environment ) == App.Constants.Boolean.false:
  16.         return
  17.     
  18.     # bring up the decrease colors to X dialog and let the user choose how many colors they want
  19.     App.Do( Environment, 'DecreaseColorsToX', {
  20.             'Boost': App.Constants.Boolean.false, 
  21.             'BoostAmount': 1, 
  22.             'Colors': 256, 
  23.             'IncludeWindowsColors': App.Constants.Boolean.false, 
  24.             'ReductionMethod': 0, 
  25.             'PaletteMethod': 0, 
  26.             'ReduceBleeding': App.Constants.Boolean.false, 
  27.             'GeneralSettings': {
  28.                 'ExecutionMode': App.Constants.ExecutionMode.Interactive, 
  29.                 'AutoActionMode': App.Constants.AutoActionMode.Match
  30.                 }
  31.             })
  32.  
  33.     # save the palette - set the palette name to match the name of the current document
  34.     # don't specify a directory so that it goes to the last used dir
  35.     
  36.     # change the extension to .psppalette - truncate the file name at the last
  37.     # period and slap on a .PspPalette extension
  38.     PaletteFileName, OldExt = os.path.splitext( App.TargetDocument.Title )
  39.     App.Do( Environment, 'SavePalette', {
  40.             'SavePaletteFileName': PaletteFileName, 
  41.             'GeneralSettings': {
  42.                 'ExecutionMode': App.Constants.ExecutionMode.Interactive, 
  43.                 'AutoActionMode': App.Constants.AutoActionMode.Match
  44.                 }
  45.             })
  46.