Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, February 13, 2008 9:50:29 AM(UTC)
cyheltsley

Groups: Registered
Posts: 6


I am taking a jpeg image and saving it as a CCITT Group 4 image.  When I look at the tiff tags, the image length and width are both 0.  Is that not automatically filled in?  If not, how do I find the lenght and width and put it in the tiff tag?

Thanks

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, February 13, 2008 10:08:28 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

If you are using a LEAD product, it should automatically update the tags when it saves the TIFF file.
How exactly are you  saving the file? Also, how did you inspect the tags?

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#3 Posted : Wednesday, February 13, 2008 11:52:22 AM(UTC)
cyheltsley

Groups: Registered
Posts: 6


The tiff tags don't appear to be updated.  I am saving:

codecs.Save(img, s.writeRi2, RasterImageFormat.CcittGroup4, 1, 1, 1, 1, CodecsSavePageMode.Append);

where s.writeRi2 is a FileStream

I am looking at the tiff tags through a program that lists each tag and I also added code in a test program to get the data

Leadtools.RasterTagMetadata tag = new RasterTagMetadata();

tag.Id = 256;

byte [] Value = tag.GetData();

which also  returns 0.  Any suggestions?

Thanks

 
#4 Posted : Thursday, February 14, 2008 7:53:42 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

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();

File Attachment(s):
testFile.tif (1kb) downloaded 21 time(s).
Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.118 seconds.