Jump to content
Squall_FF8

Is it possible to use translucent png in Image List?

Recommended Posts

Hey guys,

I would like to add couple of .png images in an ImageList using design  time ImageListEditor.
However after I click Add, I get black rectangle? Is this working in Delphi 12?

Share this post


Link to post

Standard TImageList does not support PNGs only BMPs. Try TImageCollection+TVirtualImageList instead. Or, there's a 3rd party TPngImageList floating around somewhere. 

Share this post


Link to post
1 hour ago, Remy Lebeau said:

Standard TImageList does not support PNGs only BMPs. Try TImageCollection+TVirtualImageList instead. Or, there's a 3rd party TPngImageList floating around somewhere. 

Thank you for you answer!
It is very strange to me, that Delphi doesnt support png. You can add ico, which is like png without compression. I hoped in latest version they will fix this, but alas, no (most likely never, no interest in it).

BTW by "floating", are you referring to "PngComponents" accessible trough Getit?

Share this post


Link to post
1 hour ago, Squall_FF8 said:

It is very strange to me, that Delphi doesnt support png. You can add ico, which is like png without compression.

You've most like setup your imagelist to use masked transparency (which is probably what your icons are using).

 

2 hours ago, Squall_FF8 said:

I hoped in latest version they will fix this, but alas, no (most likely never, no interest in it).

I think they've done their part with regard to this. Now you just need to do your part and read the documentation:

https://docwiki.embarcadero.com/Libraries/Sydney/en/API:Vcl.Controls.TImageList.ColorDepth

https://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.ImgList.TDrawingStyle

image.thumb.png.cd2ecbf7444c269b7b4772a4a91e2e81.png

Share this post


Link to post
2 hours ago, Squall_FF8 said:

It is very strange to me, that Delphi doesnt support png. You can add ico, which is like png without compression.

I didn't say Delphi doesn't support PNG.  I said TImageList doesn't support PNG.  Internally, TImageList is based on the Win32 IMAGELIST control, which supports only BMP and ICO images.

2 hours ago, Squall_FF8 said:

I hoped in latest version they will fix this, but alas, no (most likely never, no interest in it).

They can't "fix this" as it is a Win32 limitation.  They worked around it (amongst other reasons) by creating TImageCollection and TVirtualImageList to replace the old TImageList:

 

Supporting high-DPI images with the Image Collection and Virtual ImageList components

2 hours ago, Squall_FF8 said:

BTW by "floating", are you referring to "PngComponents" accessible trough Getit?

Probably, yes.

Edited by Remy Lebeau

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×