2023-06-10 13:46:54 -04:00
|
|
|
import gradio as gr
|
|
|
|
|
|
|
|
from modules import scripts_postprocessing
|
|
|
|
from modules.ui_components import FormRow
|
2023-11-15 19:58:17 -05:00
|
|
|
import mmaker_color_enhance_core as lib
|
2023-06-10 13:46:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
class ScriptPostprocessingColorEnhance(scripts_postprocessing.ScriptPostprocessing):
|
|
|
|
name = "Color Enhance"
|
|
|
|
order = 30000
|
|
|
|
|
|
|
|
def ui(self):
|
|
|
|
with FormRow():
|
|
|
|
strength = gr.Slider(label="Color Enhance strength", minimum=0, maximum=1, step=0.01, value=0)
|
|
|
|
return { "strength": strength }
|
|
|
|
|
|
|
|
def process(self, pp: scripts_postprocessing.PostprocessedImage, strength):
|
|
|
|
if strength == 0:
|
|
|
|
return
|
2023-11-15 20:24:16 -05:00
|
|
|
|
2023-06-10 13:46:54 -04:00
|
|
|
info_bak = {} if not hasattr(pp.image, "info") else pp.image.info
|
2023-11-15 19:58:17 -05:00
|
|
|
pp.image = lib.color_enhance(pp.image, strength)
|
2023-06-10 13:46:54 -04:00
|
|
|
pp.image.info = info_bak
|
|
|
|
pp.info["Color Enhance"] = strength
|