Load a TIFF from local storage in C#

TIFF

To load a TIFF image from local storage, use the TiffCreateMultiPageFromFile method of the GdPictureImaging class. This creates a new GdPicture representation of an image, and it returns the unique image identifier (imageID) of the newly created GdPicture image. The GdPicture image supports the multipage functionality. This method accepts the following parameters:

  • FilePath — The path to the image file.
  • LoadInMemory — Optional: A Boolean value that specifies whether to load the file content into the local machine’s memory. It’s set to false by default.

If you load the same image to the GdPictureImaging object multiple times, use the GetLastPath method instead of the FilePath parameter. This method returns the file path of the latest loaded or saved file used by the GdPictureImaging object.

When you no longer need an image resource, release it with the ReleaseGdPictureImage method.

To load a TIFF image from local storage, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Load a TIFF image from the specified path.
int imageID = gdpictureImaging.TiffCreateMultiPageFromFile(@"C:\temp\source.tif");
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
// Release the loaded GdPicture image.
gdpictureImaging.ReleaseGdPictureImage(imageID);