Click here to Skip to main content
15,877,967 members
Home / Discussions / Graphics
   

Graphics

 
AnswerRe: Plugin [modified] Pin
Baltoro5-Jun-08 6:06
Baltoro5-Jun-08 6:06 
GeneralRe: Plugin Pin
messages6-Jun-08 0:50
messages6-Jun-08 0:50 
QuestionGDI+ Scaling all wrong? Pin
Chinners4-Jun-08 1:43
Chinners4-Jun-08 1:43 
AnswerRe: GDI+ Scaling all wrong? Pin
leppie4-Jun-08 2:10
leppie4-Jun-08 2:10 
GeneralRe: GDI+ Scaling all wrong? Pin
Chinners4-Jun-08 4:14
Chinners4-Jun-08 4:14 
AnswerRe: GDI+ Scaling all wrong? Pin
Christian Graus5-Jun-08 17:54
protectorChristian Graus5-Jun-08 17:54 
QuestionRotation in DWG files Pin
Member 384581530-May-08 6:31
Member 384581530-May-08 6:31 
QuestionCheck if GDI+ bitmap has transparency Pin
TrekkieDK29-May-08 4:19
TrekkieDK29-May-08 4:19 
I just posted this in the VB group, but then realized that this is most likely the proper place to post my question. Smile | :) Here it goes:

I have opened an image as a bitmap using GDI+. Before I save it I want to know if the image has transparency in it. That is; is there any pixels in the bitmap that has the transparent color? I have made a solution that looks like this:
Dim objImage As Drawing.Bitmap = Drawing.Image.FromFile("png_with_transparent_bg.png")
Dim booTransparentColorFound As Boolean = False
If Bitmap.IsAlphaPixelFormat(objImage.PixelFormat) Then
  For y As Integer = 0 To objImage.Height - 1
    If booTransparentColorFound Then Exit For
    For x As Integer = 0 To objImage.Width - 1
      Dim objColor As Drawing.Color = objImage.GetPixel(x, y)
      If objColor.A = Color.Transparent.A And _
         objColor.R = Color.Transparent.R And _
         objColor.G = Color.Transparent.G And _
         objColor.B = Color.Transparent.B _
      Then
        booTransparentColorFound = True
        Exit For
      End If
    Next
  Next
End If

The problem is that if the image is very big, and there is no transparent pixel in it (or a transparent pixel is located in the lower right corner), the routine is very slow. Is there some quicker way to determine if there is transparency in the image?

Thanks in advance.


...Allan, Denmark
AnswerRe: Check if GDI+ bitmap has transparency Pin
Matthew Butler29-May-08 8:14
Matthew Butler29-May-08 8:14 
AnswerRe: Check if GDI+ bitmap has transparency Pin
leppie4-Jun-08 2:12
leppie4-Jun-08 2:12 
QuestionMake picturebox image mirror vertical Pin
Krishnraj26-May-08 19:51
Krishnraj26-May-08 19:51 
AnswerRe: Make picturebox image mirror vertical Pin
Matthew Butler27-May-08 9:03
Matthew Butler27-May-08 9:03 
GeneralRe: Make picturebox image mirror vertical Pin
Krishnraj27-May-08 22:55
Krishnraj27-May-08 22:55 
GeneralRe: Make picturebox image mirror vertical Pin
mahboobeh mohamadi17-Oct-10 21:25
mahboobeh mohamadi17-Oct-10 21:25 
GeneralRe: Make picturebox image mirror vertical Pin
mahboobeh mohamadi17-Oct-10 21:45
mahboobeh mohamadi17-Oct-10 21:45 
QuestionIDX3D Engine ported to C# 2.0 Pin
J Dixon25-May-08 4:05
J Dixon25-May-08 4:05 
AnswerRe: IDX3D Engine ported to C# 2.0 Pin
RichardM130-May-08 18:58
RichardM130-May-08 18:58 
GeneralRe: IDX3D Engine ported to C# 2.0 Pin
J Dixon31-May-08 3:42
J Dixon31-May-08 3:42 
GeneralRe: IDX3D Engine ported to C# 2.0 Pin
RichardM13-Jun-08 21:47
RichardM13-Jun-08 21:47 
GeneralRe: IDX3D Engine ported to C# 2.0 Pin
Member 474720127-Oct-09 23:45
Member 474720127-Oct-09 23:45 
GeneralRe: IDX3D Engine ported to C# 2.0 Pin
RichardM128-Oct-09 5:48
RichardM128-Oct-09 5:48 
GeneralRe: IDX3D Engine ported to C# 2.0 Pin
RichardM128-Oct-09 8:15
RichardM128-Oct-09 8:15 
Questioncompute final image from image on base plane (Volume Visualization) Pin
sahinmansur19-May-08 0:53
sahinmansur19-May-08 0:53 
QuestionNeed to find the object details from Kernel address Pin
Noordeen Shah17-May-08 17:20
Noordeen Shah17-May-08 17:20 
AnswerRe: Need to find the object details from Kernel address Pin
Shog917-May-08 18:03
sitebuilderShog917-May-08 18:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.