I want to open a TIFF file, put a datetime stamp on it and save that file in
CompressionCCITT4 format back to the same filename.
I have written following code to do this, but getting "Invalid parameter
used" error.
encParamsCompress = new EncoderParameters(1);
encParamsCompress.Param[0] = new EncoderParameter(encCompress,
(long)EncoderValue.CompressionCCITT4);
Image i = Image.FromFile(strImageFile);
Image t = new Bitmap(i.Width, i.Height);
Graphics g = Graphics.FromImage(t);
g.DrawImage(i, 0, 0);
i.Dispose();
Font f = new Font("Verdana",30);
g.DrawString(DateTime.Now.ToShortDateString()+":"+ DateTime.Now.ToShortTimeString(),f,Brushes.Red,10, 10,StringFormat.GenericTypographic);
f.Dispose();
g.Dispose();
t.Save(strImageFile, GetEncoderInfo("image/tiff"), encParamsCompress);
t.Dispose();
i.Dispose();
pages=(Bitmap)Image.FromFile(strImageFile);
//save the first frame
pages.Save(outFile,info,ep);
Best Regards,
Prasad