[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Color problem with DrawImage

adospace

1/20/2005 10:44:00 AM

Hi all,
I'm using DrawImage method to draw various kinds of images (bmp, gif &
jpeg) into a control paint event handler.
I notice that image drawn has different colors from the original saved
image.

For example if I draw an image with a RGB(192,192,192) background color the
resulting image displayed on the form has a RGB(198,195,198) background
color. I quite novice with GDI+: I'm only need to dispaly an image on the
form exactly as I can see with Paint.

Source Code:
Image img = Image.FromFile("path");
e.Graphics.DrawImage(img, destRect, sourceRect, GraphicsUnit.Pixel);


Thanks in advance!


1 Answer

Bob Powell

1/20/2005 11:53:00 AM

0

Are you trying to display the image with transparency?

Have you turned off the image interpolation (Graphics.InterpolationMode)

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"adospace" <adolfo.marinucci@integra-aq.it> wrote in message
news:%23q6GA0t$EHA.3824@TK2MSFTNGP10.phx.gbl...
> Hi all,
> I'm using DrawImage method to draw various kinds of images (bmp, gif &
> jpeg) into a control paint event handler.
> I notice that image drawn has different colors from the original saved
> image.
>
> For example if I draw an image with a RGB(192,192,192) background color
> the
> resulting image displayed on the form has a RGB(198,195,198) background
> color. I quite novice with GDI+: I'm only need to dispaly an image on the
> form exactly as I can see with Paint.
>
> Source Code:
> Image img = Image.FromFile("path");
> e.Graphics.DrawImage(img, destRect, sourceRect, GraphicsUnit.Pixel);
>
>
> Thanks in advance!
>
>