This is my code. When i use an image that is a jpeg format it works. But when i use a tif format it gives me a warning like "A graphics object cannot be created from an image that has an indexed pixel format" when i run it with a tif format image
Can somebody help me to solve this problem??
private void drawOnPic()
{
// Attach grapich to picturebox
Graphics g = Graphics.FromImage(pictureBox1.Image);
// Create a new pen that we shall use for drawing the line
Pen PenStyle = new Pen(Color.Red, 1);
// Draw a 50x50 pixels rectangle (x, y, width, hight)
g.DrawRectangle(PenStyle, 20, 20, 50, 50);
}
private void Form1_Load(object sender, EventArgs e)
{
drawOnPic();
}