thumbnails/processors.py
def process(file, size):
    """
    Process an image through its defined processors
    params :file: filename or file-like object
    params :size: string for size defined in settings
    return a ContentFile
    """
    from . import conf
    # open image in piccaso
    raw_image = images.from_file(file)

    # run through all processors, if defined
    size_dict = conf.SIZES[size]
    for processor in size_dict['PROCESSORS']:
        raw_image = processor['processor'](raw_image, **processor['kwargs'])

    # write to Content File
    image_io = io.BytesIO()
    raw_image.save(file=image_io)
    image_file = ContentFile(image_io.getvalue())
    #print dir(image_file)

    return image_file
def process(file, size):
    """
    Process an image through its defined processors
    params :file: filename or file-like object
    params :size: string for size defined in settings
    return a ContentFile
    """
    from . import conf
    # open image in piccaso
    raw_image = images.from_file(file)

    # run through all processors, if defined
    size_dict = conf.SIZES[size]
    for processor in size_dict['PROCESSORS']:
        raw_image = processor['processor'](raw_image, **processor['kwargs'])

    # write to Content File
    image_io = io.BytesIO()
    raw_image.save(file=image_io)
    image_file = ContentFile(image_io.getvalue())
    #print dir(image_file)

    return image_file
def process ( file , size ) : from . import conf # open image in piccaso raw_image = images . from_file ( file ) # run through all processors, if defined size_dict = conf . SIZES [ size ] for processor in size_dict [ 'PROCESSORS' ] : raw_image = processor [ 'processor' ] ( raw_image , * * processor [ 'kwargs' ] ) # write to Content File image_io = io . BytesIO ( ) raw_image . save ( file = image_io ) image_file = ContentFile ( image_io . getvalue ( ) ) #print dir(image_file) return image_file
Process an image through its defined processors
    params :file: filename or file-like object
    params :size: string for size defined in settings
    return a ContentFile
Process an image through its defined processors params : file : filename or file - like object params : size : string for size defined in settings return a ContentFile