I want to load an image file .tif
(that image has many classes of colors to indicate the height) into my picture box, when I use load image 2D as normal, it is displayed as a black image.
private static Bitmap ResizeImage(Bitmap image, Size newSize)
{
Bitmap newImage = new Bitmap(newSize.Width, newSize.Height);
using (Graphics GFX = Graphics.FromImage((Bitmap)newImage))
{
GFX.DrawImage(image, new Rectangle(Point.Empty, newSize));
}
return newImage;
}
private void loadImage_Click(object sender, EventArgs e)
{
OpenFileDialog opf = new OpenFileDialog();
opf.Title = "Select Image";
opf.Filter = "Image File (*.jpg; *.TIF; *.jpeg)| *.jpg; *.TIF; *.jpeg ";
if (opf.ShowDialog()==DialogResult.OK)
{
Bitmap image = new Bitmap(opf.FileName);
Image Image = ResizeImage(image, mapViewer.Size);
mapViewer.Image = Image;
Origin = Image;
width = Origin.Width;
height = Origin.Height;
}
}