473,513 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datetime stamp on TIFF image

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. at System.Drawing.Image.Save(String filename, ImageCodeInfo encoder,
EncoderParameters encoderParams)" error.
public void EditTIFFImage(string strImageFile)
{
EncoderParameters encParamsCompress = new EncoderParameters(1);
Encoder encCompress = new Encoder(Encoder.Compression.Guid);
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.Black,1 0,10,StringFormat.GenericTypographic);
f.Dispose();
g.Dispose();
t.Save(strImageFile.Replace(".", "temp."), GetEncoderInfo("image/tiff"),
encParamsCompress);
}
private ImageCodecInfo GetEncoderInfo(string mimeType){
ImageCodecInfo[] encoders=ImageCodecInfo.GetImageEncoders();
for (int j=0;j<encoders.Length;j++){
if (encoders[j].MimeType==mimeType)
return encoders[j];
}

throw new Exception( mimeType + " mime type not found in ImageCodecInfo" );
}

Please help.

Best Regards,
Prasad
Nov 17 '05 #1
0 2616

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4843
by: Robin Becker | last post by:
Has anyone done transparency with PIL & TIFF? I'm using PIL to generate a preview TIFF for embedding into an eps file and am being asked for the TIFF to support transparency. -- Robin Becker
2
3565
by: Al Reid | last post by:
Is it possible to display an image that is stored on the server as a TIFF image, on an ASP.Net page without the use of an add-in viewer? If so, could someone tell me how to do it? TIA -- Al...
5
5965
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
6
10019
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
1
2359
by: Benny | last post by:
I first of all need to know if the change from .NET 2.0 GDI+ to DirectX would benefit me in my situation. I need to transform multi-page tiffs to stamped single- or multi-page tiffs. I have come...
1
3428
by: Stedak | last post by:
I have the following class I use to save Tiff's. The problem I have with it is that the final size of the images are very large. If we scan directly to a file the final tiff may be 600-900 kb.s but...
7
3769
by: Ben | last post by:
Hi We are looking for a component that offers that offers the below for Tiff files: Image clean-up (deskew, despeckle) Printing capabilities from VB The ability to add text to image, e.g....
10
10671
by: =?Utf-8?B?UmludSBHb3BhbGFrcmlzaG5hIFBpbGxhaQ==?= | last post by:
Hi, Please help me to write a dll in C# , that will read each pages of a tiff image from a file and a memory stream object ( need two ways) and creatre a new tiff image object.The dll should...
3
7501
by: GiJeet | last post by:
Hello, we have an app that scans documents into TIFF format and we need to transfer them over the internet. If anyone knows of a SDK we can use that can compress TIFFs on the fly or even if it can...
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7120
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5697
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4754
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
466
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.