I tested this using LEADTOOLS 15 .NET classes and the tags came out correct. Here is the code I used. Also, I'm attaching the output file I got.
//create an all-black 640x480 image
Leadtools.RasterImage img = new
Leadtools.RasterImage(
Leadtools.RasterMemoryFlags.Conventional,
640,
480,
1,
Leadtools.RasterByteOrder.Bgr,
Leadtools.RasterViewPerspective.TopLeft, null, IntPtr.Zero, 0);
Leadtools.Codecs.RasterCodecs codecs = new Leadtools.Codecs.RasterCodecs();
//Save it to stream
System.IO.FileStream fs = new System.IO.FileStream(@"d:\testFile.tif",
System.IO.FileMode.Create);
codecs.Save(img, fs,
Leadtools.RasterImageFormat.CcittGroup4, 1, 1, 1, 1,
Leadtools.Codecs.CodecsSavePageMode.Overwrite); //Did not use Append becuase it's a new file
//Should rewind before each operation
fs.Seek(0, System.IO.SeekOrigin.Begin);
//Read the width tag
Leadtools.RasterTagMetadata tag = codecs.ReadTag(fs, 1, 256);
int imageWidth = tag.ToInt32()[0];
//Remember to rewind again
fs.Seek(0, System.IO.SeekOrigin.Begin);
tag = codecs.ReadTag(fs, 1, 257);
int imageHeight = tag.ToInt32()[0];
MessageBox.Show("Image width tag value = " + imageWidth.ToString() +
"\nImage height tag value = " + imageHeight.ToString());
fs.Close();
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.