I have an simple test. When it is solved, my problem is solved too. When working with small images, the graphics interpolation does bad work.
Please check out if you know how to fix the problem that the result image in the following code does ignore second half of image to draw. Draw something on the image by using loadimage from JPG or whatever you want.
Dim GrayImage as system.drawing.Bitmap(640,480)
Dim bmTmp As New System.Drawing.Bitmap(GrayImage.Width, 1)
Using gr As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(bmTmp)
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear
gr.DrawImage(GrayImage, New System.Drawing.Rectangle(0, 0, bmTmp.Width, bmTmp.Height), New System.Drawing.Rectangle(0, 0, GrayImage.Width - 0, GrayImage.Height - 0), System.Drawing.GraphicsUnit.Pixel)
End Using
GrayImage = New System.Drawing.Bitmap(GrayImage.Width, GrayImage.Height, GrayImage.PixelFormat)
Using gr As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(GrayImage)
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor
gr.DrawImage(bmTmp, New System.Drawing.Rectangle(0, 0, GrayImage.Width, GrayImage.Height ), New System.Drawing.Rectangle(0, 0, bmTmp.Width - 0, bmTmp.Height - 0), System.Drawing.GraphicsUnit.Pixel)
End Using
Download original Source here: http://www.goldengel.ch/temp/Source01%20one%20Pixel.jpg (one Pixel height image)
The second half vertical is not drawn by using the DrawImage methode. I want to have the image as result as you see on first picture. Stretched image with source on whole content.
* DOWNLOAD* Download here full working VS2010 VB.Net demo project: