Search

Atalasoft Knowledge Base

HOWTO: Change the TIFF Software Tag

Administrator
DotImage

When the TiffEncoder in DotImage saves a TIFF image, it will create a Software tag with the information, "Atalasoft dotImage vX.X.X.XXXX" indicating the product and version number that generated the image. You can change that tag with the following code:

TiffTag tag = new TiffTag(TiffTagID.Software, "My Software", TiffTagDataType.Ascii);
TiffEncoder enc = new TiffEncoder();
enc.TiffTags = new TiffTagCollection();
enc.TiffTags.Add(tag);
image.Save("myimage.tif", enc, null);

If you want to completely eliminate the tag, you'll need to save the image first in a temporary file, then use the TiffFile class to remove the tag.  See the following code:

image.Save("temp.tif", new TiffEncoder(), null);
TiffFile file = new TiffFile();
using (FileStream fs = new FileStream("temp.tif", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
{
      file.Read(fs);
      TiffTag tag = file.Images[0].Tags.LookupTag(TiffTagID.Software);
      file.Images[0].Tags.Remove(tag);
      file.Save("myimage.tif");
}

Original Article:
Q10132 - HOWTO: Change the TIFF Software Tag

Details
Last Modified: Last Month
Last Modified By: Administrator
Type: HOWTO
Article not rated yet.
Article has been viewed 45 times.
Options
Also In This Category