jina-ai / dalle-flow

🌊 A Human-in-the-Loop workflow for creating HD images from text
grpcs://dalle-flow.dev.jina.ai
2.83k stars 211 forks source link

Fix GFPGAN/Real-ESRGAN input image color space #142

Closed pingren closed 1 year ago

pingren commented 1 year ago

The JINA executor use PIL to load input image which the color space is RGB. While official GFPGAN use cv2 to load image with default BGR color space.

This will cause upscaled image color looks sightly different from original and usually the face becomes pale. For example:

Original Image RGB Input (Current) BGR Input (Fixed)
original 1 3-our-input-RGB 1 3-input-BGR

Using cv2.cvtColor will convert the color space to match the official implementation.

JoanFM commented 1 year ago

Thanks for the contribution @pingren