.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

DrawImage "InterpolationMode" in WPF?

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :WPF
I need to control the interpolation of a BitmapSource when it is rendered to the screen - I have an application requirement that says the images must be interpolated using nearest-neighbor when resized.  I have fruitlessly looked for something in WPF corresponding to System.Drawing.Drawing2D.InterpolationMode. The closest I have gotten is RenderOptions.SetBitmapScalingMode(...,...) but it does not do nearest-neighbor interpolation. Any ideas? Seems strange that the interpolation-options would not be available in WPF. Thanks, Andreas Hallberg

View Complete Post

More Related Resource Links

Graphics.DrawImage(image, bounds) vs SetResolution

Hi    this is what I am undertanding.   Image object never store inch information, it is two-dimentional array of pixels, thus Image object don't have a DPI.    so I conclude that Image.SetResolution is actually changing the Image width and height with the current Graphics.InterpolationMode   from the naming of enumerations of Graphics.InterpolationMode I conclude it is a Re-Sampling algorithms.   thus   If I am drawing image in terms of inches then   Image.SetResoultion(Image.Width * someFactor/ DPI, ........);  Graphics.Draw(Image)   is equivalent to   Graphics.Draw(Image, Bounds in inch)   Can some one validate this?

Resize and Crop an image using the graphics.drawimage method


Hello all,

I have been pulling out my hair trying to get this figured out and I need to tap the wisdom of the dotNet elite.

I am running dotNet 3.5 (VB.NET) , IIS7, Windows 7.

Basically, I have constructed a UI using a combination of two JQuery tools. JCrop and Resizable. Both are working on the client side and I need to save the optionally resized and optionally cropped photo after the user has completed their image manipulation.

At the moment, I have a class file that resizes images on the fly and crops them. But they scripts to handle the resized image and the cropped image are separate.

Here is the specifics:

            Dim image As New Bitmap(ThumbWidth, ThumbHeight)
            Dim g As Graphics = Graphics.FromImage(image)

            ' Load the file data.
            Dim thumbnail As System.Drawing.Image
            If ImageProcessType = ProcessType.Filename Then

Error: dc.drawimage


The code at the end of this post is generating an error.
The lines of code that are causing the error are

Problem with Graphics.DrawImage method in .Net on Windows 7 OS



We are displaying bitmap image on winform header in our dotnet application. It is displayed well on all windows operating systems. But, the same dotnet code if it runs on windows7, it does not display the image on the form. Can you please help me? Here is our code:


Dialogbase {


Rectangle captionRect = new Rectangle(0, 0, 0, 0);


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend