Profile icons are not respecting transparency properly #23182

Closed
opened 2026-01-31 08:34:37 +00:00 by claunia · 6 comments
Owner

Originally created by @Julienraptor01 on GitHub (Apr 20, 2025).

Windows Terminal version

1.22.10731.0

Windows build number

10.0.19045.0

Other Software

Custom icon inside of the zip
archlinux.zip

Steps to reproduce

  1. Create a custom profile
  2. Use the custom icon
  3. Notice the how the icon is shown
  4. Open the icon file inside of an icon editor such as GIMP and observe what the 16x variant is supposed to look like

Expected Behavior

The profile icons should properly use transparency

Manually edited images to show how it should have looked

Image

Image

Image

Actual Behavior

The profile icons seems to have a threshold where transparency information is discared or modified

Image

Image

Image

Originally created by @Julienraptor01 on GitHub (Apr 20, 2025). ### Windows Terminal version 1.22.10731.0 ### Windows build number 10.0.19045.0 ### Other Software Custom icon inside of the zip [archlinux.zip](https://github.com/user-attachments/files/19825999/archlinux.zip) ### Steps to reproduce 1. Create a custom profile 1. Use the custom icon 1. Notice the how the icon is shown 1. Open the icon file inside of an icon editor such as GIMP and observe what the 16x variant is supposed to look like ### Expected Behavior The profile icons should properly use transparency *Manually edited images to show how it should have looked* ![Image](https://github.com/user-attachments/assets/a55c6300-b7ee-4a2c-ab5a-df7d54ad700f) ![Image](https://github.com/user-attachments/assets/d2d17ef4-cd36-4559-bfe8-7c459c435b8c) ![Image](https://github.com/user-attachments/assets/ef1d4048-9e08-4972-942b-3061d53ad7cc) ### Actual Behavior The profile icons seems to have a threshold where transparency information is discared or modified ![Image](https://github.com/user-attachments/assets/49eb6212-f558-4fac-b6b3-5b49b6b0006b) ![Image](https://github.com/user-attachments/assets/54536f26-db6e-4fd9-89e0-928b9ee9ee2f) ![Image](https://github.com/user-attachments/assets/a94d73bb-2add-4a04-99c3-93634bacda0c)
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 08:34:38 +00:00
Author
Owner

@DHowett commented on GitHub (Apr 21, 2025):

Hey, so this is a really interesting topic actually!

These icon files contain raw 32bpp RGBA images plus a 1-bit alpha mask. Each image has a full alpha channel plus a simple on/off mask.

Taking the 16x16 icon as a representative example, the mask looks like this:

11111111111111110000000000000000
11111111111111110000000000000000
11011111111110110000000000000000
11100011110001110000000000000000
11100001100011110000000000000000
11110001100011110000000000000000
11110001100011110000000000000000
11111000000111110000000000000000
11111000000111110000000000000000
11111100001111110000000000000000
11111110001111110000000000000000
11111110011111110000000000000000
11111110011111110000000000000000
11111111111111110000000000000000
11111111111111110000000000000000
11111111111111110000000000000000

Cleaned up,

                ################
                ################
  #          #  ################
   ###    ###   ################
   ####  ###    ################
    ###  ###    ################
    ###  ###    ################
     ######     ################
     ######     ################
      ####      ################
       ###      ################
       ##       ################
       ##       ################
                ################
                ################
                ################

(the righthand side is ignored, and is only included as padding in the icon format. also, BMP files are stored upside-down (!))

Depending on the icon library we're using--and we're using WIC, the Windows Imaging Components--either the 1-bit mask or the alpha channel wins. In our case, it's the 1-bit mask.

Now, icon files can store PNG images as well! They compress better, they don't exhibit confusion between the two different alpha channels, and they're compatible with every OS since Vista.

If you use this icon--which is the same, except using PNG data instead of RGBA BMP--it's only ~142KB instead of 1.4_MB_ and it works perfectly well in Terminal.

archlinux-png.zip

If you got this icon from the Arch Linux folks, they may benefit from using the new one too!

@DHowett commented on GitHub (Apr 21, 2025): Hey, so this is a really interesting topic actually! These icon files contain raw 32bpp RGBA images _plus a 1-bit alpha mask._ Each image has a full alpha channel plus a simple on/off mask. Taking the 16x16 icon as a representative example, the mask looks like this: ``` 11111111111111110000000000000000 11111111111111110000000000000000 11011111111110110000000000000000 11100011110001110000000000000000 11100001100011110000000000000000 11110001100011110000000000000000 11110001100011110000000000000000 11111000000111110000000000000000 11111000000111110000000000000000 11111100001111110000000000000000 11111110001111110000000000000000 11111110011111110000000000000000 11111110011111110000000000000000 11111111111111110000000000000000 11111111111111110000000000000000 11111111111111110000000000000000 ``` Cleaned up, ``` ################ ################ # # ################ ### ### ################ #### ### ################ ### ### ################ ### ### ################ ###### ################ ###### ################ #### ################ ### ################ ## ################ ## ################ ################ ################ ################ ``` _(the righthand side is ignored, and is only included as padding in the icon format. also, BMP files are stored upside-down (!))_ Depending on the icon library we're using--and we're using WIC, the Windows Imaging Components--either the 1-bit mask or the alpha channel wins. In our case, it's the 1-bit mask. Now, icon files can store PNG images as well! They compress better, they don't exhibit confusion between the two different alpha channels, and they're compatible with every OS since Vista. If you use this icon--which is the same, except using PNG data instead of RGBA BMP--it's only ~142KB instead of 1.4_MB_ and it works perfectly well in Terminal. [archlinux-png.zip](https://github.com/user-attachments/files/19837474/archlinux-png.zip) _If you got this icon from the Arch Linux folks, they may benefit from using the new one too!_
Author
Owner

@Julienraptor01 commented on GitHub (Apr 21, 2025):

Hey, so this is a really interesting topic actually!

These icon files contain raw 32bpp RGBA images plus a 1-bit alpha mask. Each image has a full alpha channel plus a simple on/off mask.

Taking the 16x16 icon as a representative example, the mask looks like this:

11111111111111110000000000000000
11111111111111110000000000000000
11011111111110110000000000000000
11100011110001110000000000000000
11100001100011110000000000000000
11110001100011110000000000000000
11110001100011110000000000000000
11111000000111110000000000000000
11111000000111110000000000000000
11111100001111110000000000000000
11111110001111110000000000000000
11111110011111110000000000000000
11111110011111110000000000000000
11111111111111110000000000000000
11111111111111110000000000000000
11111111111111110000000000000000

Cleaned up,

                ################
                ################
  #          #  ################
   ###    ###   ################
   ####  ###    ################
    ###  ###    ################
    ###  ###    ################
     ######     ################
     ######     ################
      ####      ################
       ###      ################
       ##       ################
       ##       ################
                ################
                ################
                ################

(the righthand side is ignored, and is only included as padding in the icon format)

Depending on the icon library we're using--and we're using WIC, the Windows Imaging Components--either the 1-bit mask or the alpha channel wins. In our case, it's the 1-bit mask.

Now, icon files can store PNG images as well! They compress better, they don't exhibit confusion between the two different alpha channels, and they're compatible with every OS since Vista.

If you use this icon--which is the same, except using PNG data instead of RGBA BMP--it's only ~142KB instead of 1.4_MB_ and it works perfectly well in Terminal.

archlinux-png.zip

If you got this icon from the Arch Linux folks, they may benefit from using the new one too!

So for the story about why, the default icon for the archlinux WSL distro that come when you do

wsl --install archlinux

sadly only has an icon with a white background and a low res of 64px, so i wanted to make a custom one that would look nicer
So what i did is take the logo as SVG as they provide on the art page, manually edited the SVG with inkscape to remove the text and only keep the icon as they only provide the logo and not the icon

<svg width="256" height="256"><path fill="#1793d1" d="M127.9811 27.496998c-8.94657 21.934717-14.34271 36.282599-24.30355 57.565279 6.10724 6.473703 13.60359 14.012653 25.77764 22.527183-13.08829-5.38578-22.01611-10.792965-28.68802-16.404022C88.0192 117.78615 68.046794 155.6777 27.516347 228.503c31.85557-18.39086 56.549442-29.72902 79.562943-34.05536-.9882-4.25029-1.55004-8.84781-1.51188-13.64483l.0378-1.02052c.50547-20.40911 11.12223-36.10372 23.69879-35.03809 12.57658 1.06563 22.35221 18.48429 21.84674 38.89341-.0951 3.84035-.52824 7.53473-1.2851 10.96122 22.76364 4.45299 47.19346 15.76213 78.61802 33.90417-6.19631-11.40789-11.72705-21.69127-17.00871-31.48515-8.31947-6.44817-16.99708-14.84048-34.69776-23.92568 12.16643 3.16136 20.87744 6.80873 27.66749 10.88562-53.70007-99.980597-58.04862-113.265956-76.46358-156.480792Z"/></svg>

I then used inkscape CLI to export those as PNG

mkdir -p archlinux && for size in 256 240 216 192 180 160 144 128 120 108 96 90 80 72 64 60 48 40 36 32 30 24 20 16; do inkscape archlinux.svg --export-width=$size --export-height=$size --export-filename=archlinux/${size}.png; done

After that i thought that i should optimize my PNGs before bundling them into the ico so i used oxipng

cp -r archlinux normal && cp -r archlinux zopfli && oxipng -v -o max --strip all --nb --nc --np --ng -r normal && oxipng -v -Z -o max --strip all --nb --nc --np --ng -r zopfli && { printf "File\tNormal\tZopfli\tCopy\n"; for size in 256 240 216 192 180 160 144 128 120 108 96 90 80 72 64 60 48 40 36 32 30 24 20 16; do nsize=$(stat -c%s normal/${size}.png); zsize=$(stat -c%s zopfli/${size}.png); printf "%s\t%s\t%s\t" "${size}.png" "$nsize" "$zsize"; [ "$nsize" -le "$zsize" ] && cp -v normal/${size}.png archlinux/${size}.png || cp -v zopfli/${size}.png archlinux/${size}.png; done } | column -t && rm -rf normal zopfli

Once that was done i bundled them with icotool like this

icotool -c -o archlinux.ico $(find archlinux -type f -name '*.png' | sort -V)

Did i use the wrong tool to make the ico file ? How would i force it to store the PNGs as PNGs instead of as BMPs inside of the ico file ?

@Julienraptor01 commented on GitHub (Apr 21, 2025): > Hey, so this is a really interesting topic actually! > > These icon files contain raw 32bpp RGBA images _plus a 1-bit alpha mask._ Each image has a full alpha channel plus a simple on/off mask. > > Taking the 16x16 icon as a representative example, the mask looks like this: > > ``` > 11111111111111110000000000000000 > 11111111111111110000000000000000 > 11011111111110110000000000000000 > 11100011110001110000000000000000 > 11100001100011110000000000000000 > 11110001100011110000000000000000 > 11110001100011110000000000000000 > 11111000000111110000000000000000 > 11111000000111110000000000000000 > 11111100001111110000000000000000 > 11111110001111110000000000000000 > 11111110011111110000000000000000 > 11111110011111110000000000000000 > 11111111111111110000000000000000 > 11111111111111110000000000000000 > 11111111111111110000000000000000 > ``` > > Cleaned up, > > ``` > ################ > ################ > # # ################ > ### ### ################ > #### ### ################ > ### ### ################ > ### ### ################ > ###### ################ > ###### ################ > #### ################ > ### ################ > ## ################ > ## ################ > ################ > ################ > ################ > ``` > > _(the righthand side is ignored, and is only included as padding in the icon format)_ > > Depending on the icon library we're using--and we're using WIC, the Windows Imaging Components--either the 1-bit mask or the alpha channel wins. In our case, it's the 1-bit mask. > > Now, icon files can store PNG images as well! They compress better, they don't exhibit confusion between the two different alpha channels, and they're compatible with every OS since Vista. > > If you use this icon--which is the same, except using PNG data instead of RGBA BMP--it's only ~142KB instead of 1.4_MB_ and it works perfectly well in Terminal. > > [archlinux-png.zip](https://github.com/user-attachments/files/19837474/archlinux-png.zip) > > _If you got this icon from the Arch Linux folks, they may benefit from using the new one too!_ So for the story about why, the default icon for the archlinux WSL distro that come when you do ```powershell wsl --install archlinux ``` sadly only has an icon with a white background and a low res of 64px, so i wanted to make a custom one that would look nicer So what i did is take the logo as SVG as they provide on the [art page](https://archlinux.org/art), manually edited the SVG with inkscape to remove the text and only keep the icon as they only provide the logo and not the icon ```svg <svg width="256" height="256"><path fill="#1793d1" d="M127.9811 27.496998c-8.94657 21.934717-14.34271 36.282599-24.30355 57.565279 6.10724 6.473703 13.60359 14.012653 25.77764 22.527183-13.08829-5.38578-22.01611-10.792965-28.68802-16.404022C88.0192 117.78615 68.046794 155.6777 27.516347 228.503c31.85557-18.39086 56.549442-29.72902 79.562943-34.05536-.9882-4.25029-1.55004-8.84781-1.51188-13.64483l.0378-1.02052c.50547-20.40911 11.12223-36.10372 23.69879-35.03809 12.57658 1.06563 22.35221 18.48429 21.84674 38.89341-.0951 3.84035-.52824 7.53473-1.2851 10.96122 22.76364 4.45299 47.19346 15.76213 78.61802 33.90417-6.19631-11.40789-11.72705-21.69127-17.00871-31.48515-8.31947-6.44817-16.99708-14.84048-34.69776-23.92568 12.16643 3.16136 20.87744 6.80873 27.66749 10.88562-53.70007-99.980597-58.04862-113.265956-76.46358-156.480792Z"/></svg> ``` I then used inkscape CLI to export those as PNG ```bash mkdir -p archlinux && for size in 256 240 216 192 180 160 144 128 120 108 96 90 80 72 64 60 48 40 36 32 30 24 20 16; do inkscape archlinux.svg --export-width=$size --export-height=$size --export-filename=archlinux/${size}.png; done ``` After that i thought that i should optimize my PNGs before bundling them into the ico so i used oxipng ```bash cp -r archlinux normal && cp -r archlinux zopfli && oxipng -v -o max --strip all --nb --nc --np --ng -r normal && oxipng -v -Z -o max --strip all --nb --nc --np --ng -r zopfli && { printf "File\tNormal\tZopfli\tCopy\n"; for size in 256 240 216 192 180 160 144 128 120 108 96 90 80 72 64 60 48 40 36 32 30 24 20 16; do nsize=$(stat -c%s normal/${size}.png); zsize=$(stat -c%s zopfli/${size}.png); printf "%s\t%s\t%s\t" "${size}.png" "$nsize" "$zsize"; [ "$nsize" -le "$zsize" ] && cp -v normal/${size}.png archlinux/${size}.png || cp -v zopfli/${size}.png archlinux/${size}.png; done } | column -t && rm -rf normal zopfli ``` Once that was done i bundled them with icotool like this ```bash icotool -c -o archlinux.ico $(find archlinux -type f -name '*.png' | sort -V) ``` Did i use the wrong tool to make the ico file ? How would i force it to store the PNGs as PNGs instead of as BMPs inside of the ico file ?
Author
Owner

@Julienraptor01 commented on GitHub (Apr 21, 2025):

ok so i searched a bit more, opened my ico and your ico with imhex, and indeed i could see that mine were BMPs and yours were PNGs
so i tried a different tool, imagemagick

magick $(find archlinux -type f -name '*.png' | sort -V) archlinux.ico

and it did very slightly better
archlinux.zip
so i opened it in imhex and i found out that it sadly only kept the last biggest picture as PNG
i'm searching to see if i can find a tool that allow me to keep them all as PNG inside of the ico, what tool did you use ?

@Julienraptor01 commented on GitHub (Apr 21, 2025): ok so i searched a bit more, opened my ico and your ico with imhex, and indeed i could see that mine were BMPs and yours were PNGs so i tried a different tool, imagemagick ```bash magick $(find archlinux -type f -name '*.png' | sort -V) archlinux.ico ``` and it did very slightly better [archlinux.zip](https://github.com/user-attachments/files/19838748/archlinux.zip) so i opened it in imhex and i found out that it sadly only kept the last biggest picture as PNG i'm searching to see if i can find a tool that allow me to keep them all as PNG inside of the ico, what tool did you use ?
Author
Owner

@DHowett commented on GitHub (Apr 21, 2025):

Oh, I've never heard of icotool!

I was using @jtippet's IcoTools (funny enough), which offers IcoCat for constructing icons out of component parts. It also has an icon linter, which did warn about your original icons (but not in a way that made immediate sense to me, so I sort-of ignored it1 ). It's a cross-platform C# project.

https://github.com/jtippet/icotools


  1. with hindsight, it makes sense ↩︎

@DHowett commented on GitHub (Apr 21, 2025): Oh, I've never heard of icotool! I was using @jtippet's IcoTools (funny enough), which offers `IcoCat` for constructing icons out of component parts. It also has an icon linter, which did [warn](https://github.com/jtippet/IcoTools/wiki/ICO221) about your original icons (but not in a way that made immediate sense to me, so I sort-of ignored it[^1]). It's a cross-platform C# project. https://github.com/jtippet/icotools [^1]: with hindsight, it makes sense
Author
Owner

@Julienraptor01 commented on GitHub (Apr 21, 2025):

Oh, I've never heard of icotool!

I was using @jtippet's IcoTools (funny enough), which offers IcoCat for constructing icons out of component parts. It also has an icon linter, which did warn about your original icons (but not in a way that made immediate sense to me, so I sort-of ignored it[^1]). It's a cross-platform C# project.

https://github.com/jtippet/icotools

Interesting
I honestly would likely have never found it tbh
Thanks for the tool

@Julienraptor01 commented on GitHub (Apr 21, 2025): > Oh, I've never heard of icotool! > > I was using @jtippet's IcoTools (funny enough), which offers `IcoCat` for constructing icons out of component parts. It also has an icon linter, which did [warn](https://github.com/jtippet/IcoTools/wiki/ICO221) about your original icons (but not in a way that made immediate sense to me, so I sort-of ignored it[^1]). It's a cross-platform C# project. > > https://github.com/jtippet/icotools Interesting I honestly would likely have never found it tbh Thanks for the tool
Author
Owner

@DHowett commented on GitHub (Apr 23, 2025):

Hope you managed to get your icon build sorted! Thanks for filing :)

@DHowett commented on GitHub (Apr 23, 2025): Hope you managed to get your icon build sorted! Thanks for filing :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23182