I actually started to look t this last week but couldn't get any support ( which I can understand since it's free). I am looking to create a laboratory report. In one of their examples they build a bridge.
using BitMiracle.LibTiff.Classic;
namespace WriteTiff
{
class Program
{
static void Main(string[] args)
{
byte[] buffer = new byte[25 * 144]
{
};
using (Tiff image = Tiff.Open("output.tif", "w"))
{
if (image == null)
{
System.Console.Error.WriteLine("Could not open output.tif for writing");
return;
}
image.SetField(TiffTag.IMAGEWIDTH, 25 * 8);
image.SetField(TiffTag.IMAGELENGTH, 144);
image.SetField(TiffTag.BITSPERSAMPLE, 1);
image.SetField(TiffTag.SAMPLESPERPIXEL, 1);
image.SetField(TiffTag.ROWSPERSTRIP, 144);
image.SetField(TiffTag.COMPRESSION, Compression.CCITTFAX4);
image.SetField(TiffTag.PHOTOMETRIC, Photometric.MINISWHITE);
image.SetField(TiffTag.FILLORDER, FillOrder.MSB2LSB);
image.SetField(TiffTag.PLANARCONFIG, PlanarConfig.CONTIG);
image.SetField(TiffTag.XRESOLUTION, 150.0);
image.SetField(TiffTag.YRESOLUTION, 150.0);
image.SetField(TiffTag.RESOLUTIONUNIT, ResUnit.INCH);
image.WriteEncodedStrip(0, buffer, 25 * 144);
image.Close();
}
}
}
}
Let's say I want to create a TIFF file that contains says "Hello World" in bold. Can you please supply an example of how I would code this with LibTiff?
Thank you.