Skip to content

fix: preserve PNG transparency in chat wallpapers#30698

Open
pratikpatel8982 wants to merge 1 commit into
telegramdesktop:devfrom
pratikpatel8982:patch-1
Open

fix: preserve PNG transparency in chat wallpapers#30698
pratikpatel8982 wants to merge 1 commit into
telegramdesktop:devfrom
pratikpatel8982:patch-1

Conversation

@pratikpatel8982
Copy link
Copy Markdown

@pratikpatel8982 pratikpatel8982 commented May 15, 2026

Respect the user's chosen image as-is without forcing opacity, which naturally enables transparent chat background support.

fixes #29773

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 15, 2026

CLA assistant check
All committers have signed the CLA.

Remove .forceOpaque = true from ChooseFromFile in settings_chat.cpp and BackgroundBox::chooseFromFile in background_box.cpp, which was compositing transparent pixels against white via Opaque() for all non-JPEG files before the image reached the wallpaper pipeline.
@ilya-fedin
Copy link
Copy Markdown
Contributor

Did you actually test it? The server accepts only jpegs so it will lose the transparency anyway, all you likely did is that the transparency will turn black instead of white.

@pratikpatel8982
Copy link
Copy Markdown
Author

pratikpatel8982 commented May 21, 2026

Did you actually test it? The server accepts only jpegs so it will lose the transparency anyway, all you likely did is that the transparency will turn black instead of white.

yes i tested it, the chat backround wallpaper is chosen through the chat settings,
and by setting forceOpaque=false the pipeline preserve transparency of the chat background.
image

  1. The option Choose from File has its own file-chooser method inside settings_chat.cpp and this option was tested by me.
  2. However Choose from Gallery option further expands to gallery and another Choose from file option which is taken from background_box.cpp. This was added later and is untested. However it should work the same cause they both call the same method and later go through the same pipeline.
image

Here is the image, a fully transparent png which was used for testing.
Transparente

Here is the result: half screenshot of chat window.
image

here is the compiled app (linux)+ the transparent png used: https://gofile.io/d/30Ludp
It also supports semi-transparent images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

White background in chat, when it's supposed to be transparent

3 participants