?
Solved

Image Transparency

Posted on 2003-10-27
7
Medium Priority
?
187 Views
Last Modified: 2010-05-01
Many thanks in advance!

I have a picture that has a red [ RGB(255,0,0) ] background color. How would I go about making it so that the red part is transparent? By transparent, I mean that the red part becomes see through. Thanks everybody!!
0
Comment
Question by:blizzdek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
7 Comments
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9631848
I suggest converting this picture to GIF format and set the red color as transparent.
You can convert it to WMF format also, but it is for simple graphics only. It's not a bitmaped graphics format - it's vector graphics
0
 
LVL 3

Expert Comment

by:pg_india
ID: 9631901
i think you need a code in program vb

http://www.visualbasicforum.com/showthread.php?t=8118

try this link
0
 

Author Comment

by:blizzdek
ID: 9634627
Uhh... PG_India, all they do on that post is talk about relevant stuff but they never get around to answering the question... I just need code for image transparency; that's all...
0
 
LVL 3

Accepted Solution

by:
pg_india earned 280 total points
ID: 9639706
TransparentBlt API
mask image and use BitBlt

well these are the three functions which they have refereed to...Are you facing any problem in using these 3 functions.

I suggest better try with "TransparentBlt". This will work for u.

An example of this is:

'This project needs 2 pictureboxes
'Picturebox1 must contain a picture with a lot of white pixels (we're going to use white as transparent color)
Private Declare Function TransparentBlt Lib "msimg32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal crTransparent As Long) As Boolean
Private Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Picture1.AutoSize = True
    'API uses pixels
    Picture1.ScaleMode = vbPixels
    Picture2.ScaleMode = vbPixels
End Sub
Private Sub Picture2_Paint()
    'If we don't call DoEvents first, our transparent image will be completely wrong
    DoEvents
    TransparentBlt Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbWhite
End Sub
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question