Exemplo n.º 1
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     min_dim = min(model.original.width, model.original.height)
     return [
         SmartCrop(width=min_dim, height=min_dim),
         ResizeToFill(width=500, height=500)
     ]
Exemplo n.º 2
0
 def processors(self):
     """ Dynamically create the list of image processors using the model
     instance. """
     instance, field_name = get_field_info(self.source)
     return [
         ExifGpsExtractor(instance),
         ResizeToFit(1000, 1000, False),
     ]
Exemplo n.º 3
0
    def processors(self):
        model, field_name = get_field_info(self.source)

        size = (225, 175)

        return [
            ResizeToFit(*size),
        ]
Exemplo n.º 4
0
 def processors(self):
     """ Dynamically create the list of image processors using the model
     instance. """
     instance, field_name = get_field_info(self.source)
     return [
         ExifGpsExtractor(instance),
         ResizeToFit(1000, 1000, False),
     ]
Exemplo n.º 5
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     min_dim = min(model.image_file.width, model.image_file.height)
     return [
         Crop(width=min_dim,
              height=min_dim,
              x=int(-1 * model.image_x * model.image_file.width),
              y=int(-1 * model.image_y * model.image_file.height))
     ]
Exemplo n.º 6
0
Arquivo: specs.py Projeto: Siyet/ccp
    def processors(self):
        instance, field_name = get_field_info(self.source)
        cache = instance.cache.filter(
            resolution=CACHE_RESOLUTION.preview).first()
        if not cache or not path.isfile(cache.file.path):
            return []

        return [
            ComposeSample(cache.file.path, instance.needs_shadow),
            ResizeToFit(*self.size)
        ]
Exemplo n.º 7
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     min_dim = min(model.image_file.width, model.image_file.height)
     return [
         Crop(
             width=min_dim,
             height=min_dim,
             x=int(-1 * model.image_x * model.image_file.width),
             y=int(-1 * model.image_y * model.image_file.height),
         )
     ]
	def __init__(self, source, specs):

		instance, attname = get_field_info(source)
		self.specs = specs
		
		#Apply specs to instance
		for attr_name in specs:
			setattr(self, attr_name, specs[attr_name])

		self.source = source
		self.instance = instance
		self.attname = attname
		
		self.init_processors()
			
		super(InstanceSpec, self).__init__(source)
Exemplo n.º 9
0
    def __init__(self, source, specs):

        instance, attname = get_field_info(source)
        self.specs = specs

        #Apply specs to instance
        for attr_name in specs:
            setattr(self, attr_name, specs[attr_name])

        self.source = source
        self.instance = instance
        self.attname = attname

        self.init_processors()

        super(InstanceSpec, self).__init__(source)
Exemplo n.º 10
0
    def processors(self):
        """ Dynamically create the list of image processors using the model
        instance. """
        # August 2018: found that this code no longer seems to be
        # able to produce a model instance as it must have in the past.
        # When this happens, the ExifGpsExtractor image processor below
        # cannot save any extracted latitude or longitude coordinates.
        # TODO: debug and resolve, or else extract and save coordinates
        # another way (such as client side).
        print(('processors(): self.source:', self.source))
        print(('processors(): type(self.source):', type(self.source)))
        instance, field_name = get_field_info(self.source)
        print(('processors() instance:', instance))
        print(('processors() field_name:', field_name))

        return [
            ExifGpsExtractor(instance),
            ResizeToFit(1000, 1000, False),
        ]
Exemplo n.º 11
0
    def processors(self):
        """ Dynamically create the list of image processors using the model
        instance. """
        # August 2018: found that this code no longer seems to be
        # able to produce a model instance as it must have in the past.
        # When this happens, the ExifGpsExtractor image processor below
        # cannot save any extracted latitude or longitude coordinates.
        # TODO: debug and resolve, or else extract and save coordinates
        # another way (such as client side).
        print 'processors(): self.source:', self.source
        print 'processors(): type(self.source):', type(self.source)
        instance, field_name = get_field_info(self.source)
        print 'processors() instance:', instance
        print 'processors() field_name:', field_name

        return [
            ExifGpsExtractor(instance),
            ResizeToFit(1000, 1000, False),
        ]
Exemplo n.º 12
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     crop_width = int(model.original.width)
     crop_height = min(model.original.height, int(crop_width * 3.0 / 5.0))
     return [SmartCrop(width=crop_width, height=crop_height)]
Exemplo n.º 13
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     min_dim = min(model.original.width, model.original.height)
     return [SmartCrop(width=min_dim, height=min_dim), ResizeToFill(width=500, height=500)]
Exemplo n.º 14
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     if model.image.height > model.image.width:
         return [ResizeToFill(250, 352)]
     else:
         return [ResizeToFill(250, 169)]
Exemplo n.º 15
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     # return [ResizeToFill(model.album_cover.width/3,
     #                      model.album_cover.height/3)]
     return [ResizeToFill(800, 600)]
Exemplo n.º 16
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     return [ResizeToFill(600, 600, anchor=model.anchor)]
Exemplo n.º 17
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     return [processors.Crop(model.width, model.width, anchor=processors.Anchor.TOP)]
Exemplo n.º 18
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     crop_width = int(model.original.width)
     crop_height = min(model.original.height, int(crop_width * 3.0 / 5.0))
     return [SmartCrop(width=crop_width, height=crop_height)]
Exemplo n.º 19
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     color = convert_to_rgb(model.watermark_color)
     return [Watermark(text=COPY_WRITE, color=color), ResizeToFit(600, 600)]
Exemplo n.º 20
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     return [ResizeToFill(model.width, model.height)]
Exemplo n.º 21
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     return [RotateEXIF(model.orientation), ResizeToFill(200, 130)]
Exemplo n.º 22
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     return [ResizeToFill(model.THUMB_WIDTH, model.THUMB_HEIGHT)]
Exemplo n.º 23
0
 def processors(self):
     model, field = get_field_info(self.source)
     return [ResizeToFit(400)]
Exemplo n.º 24
0
 def processors(self):
     model, field_name = get_field_info(self.source)
     if model.img.width > 800:
         return [RotateEXIF(model.orientation), ResizeToFit(1280, 700)]
     else:
         return [RotateEXIF(model.orientation)]