Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A way to put transparence into TImage picture

Status
Not open for further replies.

ZeeNer

Programmer
Jun 2, 2002
38
0
0
CA
Hello !
Im wanting to turn , for exemple , the 'yellow' color into 'transparence'... The picture can change so the code must be in consequence (I cannot use the Basic 'Mask' In the 'form' in know). The simple boolean propriety *.Transparent of the TImage not always work so i want something more 'efficient' :p

Anyone who know a way to do it, please help me ! Any clue or html link will be appreciate ;)

 
Hi,
as far as I remember, it should be the pixel in the left down corner that gives you the transparent color.


Ciao,
GeppoDarkson.
 
AFAIK, bitmaps don't support transparency, but gifs (and other types) do. I asked a similar non-Delphi question which you might find useful: thread215-615484

Hope this helps!

Clive [infinity]
Ex nihilo, nihil fit (Out of nothing, nothing comes)
 
Generally speaking, bitmaps don't supports tansparency,
but if you use a TImage with a bitmap, setting TImage.Transparent=True will make all the pixels with the color of the Bottom-Left pixel transparent.

It works also for the Button glypht.

Ciao,
GeppoDarkson.
 
Mmmm... i know that .Transparent work well for the 'Left-Bottom' part of a bitmap but sometimes (it depend of the picture) it doesnt work and my background stay 'Yellow' =/
I don't find this 'way' to do it very stable if during the execution of the application the Picture of the TImage control is changed very often...

Im sure that there is a way to do this (with any type of picture) using some kind of methodes of a TImage component... (like put transparence with a 'mask'... but allowing to change a 'color' to transparence) However thankx guys! If someone have an idea of how to do it you're welcome ;)
 
Hi,
Try to use a second image and copy pixel by pixel except for the pixels of one specified color.

By the way, maybe a short description on what are you intent to do can be usefull to give the right suggest.

Ciao,
GeppoDarkson.
 
This should work

image1.Picture.Bitmap.TransparentColor:=clyellow;
image1.Transparent:=true;

jb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top