When you say that you're resizing an image and the background canvas is also
sampled I think that you're suggesting that you're resizing directly from
the screen or from a back-buffer bitmap that you paint to the screen. This
is probably a bad idea for the reasons that you've already discovered.
You should be resizing the original image bits in some off-screen operation.
Also, try using the HighQualityBilinear interpolation mode. I find that this
tends to work better and produce a more pleasing effect.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
[quoted text, click to view] "Andreas Zita" <andreas.zita@gmail.com> wrote in message
news:unyztp$IGHA.3696@TK2MSFTNGP15.phx.gbl...
> Hi
>
> Im using DrawImage to resize large images to smaller ones.
>
> I use InterpolationMode =
> System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic to obtain a
> good downsampling of the pixels in the image.
>
> However no matter what I do I get visible black lines (or whatever
> background color of the canvas bitmap is set to) at the left and top side
> of the resulting image. I believe this is caused by the interpolation
> algorithm which is using the backgroundcolor to antialias the edges of
> whatever is drawn to the canvas. But in my case I don't want to antialias
> to the background at all! I should be a simple matter to disregard the
> background with some boundary conditions? Is there any solution to this
> problem? Or do I have to write my own image resize code to get sharp
> edges?
>
> /Andreas
>