示例#1
0
 def __init__(self, imagepath):
   # Base options
   self.base_image = ImageManager.newFromPath(imagepath)
   self.base_image.load()
   self.colours = None
   self.collage_image = CollageImage.new(self.base_image.size)
   self.output_image_savepath = None
   self.images_folder = None
   self.debug = False
   self.log = None
   # Collage options
   self.precision = DEFAULT_PRECISION
   self.threshold = DEFAULT_THRESHOLD
   self.near_size = DEFAULT_NEAR_SIZE
   self.scale_factor = 1
   self.shuffle_colours = False
   self.shuffle_colours_distance = DEFAULT_SHUFFLE_COLOURS_DISTANCE
   self.shuffle_geometry = DEFAULT_SHUFFLE_GEOMETRY
   # Workflow options
   self.show_partials = False
   # Class variables
   self.sector_size = None
   self.collage_image_size = None
   self.collage_image_size_precision = DEFAULT_COLLAGE_IMAGE_SIZE_PRECISION
   self.collage_image_size_min = None # Enforced limit
   self.collage_image_size_max_width = None # Non-enforced limit
   self.collage_image_size_max_height = None # Non-enforced limit
   # Collage variables
   self.collage_same_height_streak = DEFAULT_COLLAGE_SAME_HEIGHT_STREAK
   self.collage_same_height_streak_max = DEFAULT_COLLAGE_SAME_HEIGHT_STREAK
 def reload(self):
   self.images = {}
   imgpath = self.base_img.getFilepath()
   self.base_img = ImageManager.newFromPath(imgpath)
def newColourFromPath(imgpath, sector_size=None):
  img = ImageManager.newFromPath(imgpath)
  colour = CollageColour(img, sector_size)
  return colour