langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
51.26k stars 7.38k forks source link

Transparent PNG Logo Uploads Result in Unwanted Black Background #8578

Closed uamyangel closed 1 month ago

uamyangel commented 1 month ago

Self Checks

Dify version

0.8.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Prepare a PNG image with a transparent background
  2. Access the WebApp's logo upload feature
  3. Select and upload the transparent PNG file
  4. View the uploaded logo in the WebApp

✔️ Expected Behavior

The logo should display with its transparent background, allowing the underlying page elements to show through.

❌ Actual Behavior

The logo appears surrounded by a black background, replacing the intended transparency. image

dosubot[bot] commented 1 month ago

Hey @uamyangel! 👋 I'm here to help you with any bugs, questions, or contributions you have for the Dify project. Let's work together to solve this issue!

The issue you're experiencing with transparent PNG logos resulting in an unwanted black background could be due to how the image is processed or displayed in the web app. Here are a few areas to investigate and potential solutions:

  1. Image Processing:

    • Ensure that the FileService.upload_file method does not alter the transparency of PNG images during the upload process. The method should handle PNG files correctly without converting them to a format that loses transparency.
  2. Frontend Display:

    • Check the CSS styles and configurations in the frontend components responsible for displaying the logo. Specifically, ensure that the img element displaying the logo does not have any background styles applied that could cause the black background.
  3. Image Upload Handling:

    • Verify that the image upload handling in CustomWebAppBrand component correctly processes and displays PNG images with transparency. The handleChange function should handle the file upload without altering the image's transparency.

Here are the relevant code snippets and files to review:

By ensuring that the image processing and frontend display correctly handle PNG transparency, you should be able to resolve the issue with the unwanted black background.

To continue talking to Dosu, mention @dosu.