Add adjust_options
This gives the user the ability to process the images after resizing them. In particular, the color, contrast, brightness and sharpness can be adjusted.
This commit is contained in:
@@ -72,6 +72,9 @@ def generate_image(source, outname, settings, options=None):
|
||||
processor = processor_cls(*settings['img_size'], upscale=False)
|
||||
img = processor.process(img)
|
||||
|
||||
# Adjust the image after resizing
|
||||
img = Adjust(**settings['adjust_options']).process(img)
|
||||
|
||||
if settings['copyright']:
|
||||
add_copyright(img, settings['copyright'])
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ _DEFAULT_CONFIG = {
|
||||
'destination': '_build',
|
||||
'img_size': (640, 480),
|
||||
'img_processor': 'ResizeToFit',
|
||||
'adjust_options': {'color': 1.0, 'brightness': 1.0,
|
||||
'contrast': 1.0, 'sharpness': 1.0},
|
||||
'make_thumbs': True,
|
||||
'thumb_prefix': '',
|
||||
'thumb_suffix': '',
|
||||
|
||||
@@ -26,6 +26,13 @@ img_size = (800, 600)
|
||||
# - SmartResize: identical to ResizeToFill, but uses entropy to crop the image
|
||||
# img_processor = 'ResizeToFit'
|
||||
|
||||
# Adjust the image after resizing it. A default value of 1.0 leaves the images
|
||||
# untouched.
|
||||
# adjust_options = {'color': 1.0,
|
||||
# 'brightness': 1.0,
|
||||
# 'contrast': 1.0,
|
||||
# 'sharpness': 1.0}
|
||||
|
||||
# Generate thumbnails
|
||||
# make_thumbs = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user