Image

To load an image from local storage, use the CreateGdPictureImageFromFile method of the GdPictureImaging class.

This method returns a non-zero GdPicture image identifier (imageID) when successful. If it fails, it returns 0 — use GetStat() to get the failure reason.

CreateGdPictureImageFromFile has overloads that let you specify:

  • FilePath — Path to the image file (or empty string to prompt file selection on Windows).
  • LoadInMemory (optional, default false) — Loads file content into memory for better manipulation performance.
  • DirectAccess (optional, default false) — Loads only properties/metadata/embedded thumbnail (no pixel decoding). Pixel-dependent operations will fail in this mode.

Use the GetLastPath method to retrieve the last loaded/saved file path used by the GdPictureImaging instance.

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

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

using GdPicture14;
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
int imageID = gdpictureImaging.CreateGdPictureImageFromFile(@"C:\temp\source.jpg", false);
if (imageID == 0)
{
Console.WriteLine($"Load failed: {gdpictureImaging.GetStat()}");
return;
}
GdPictureStatus status = gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"Save failed: {status}");
}
gdpictureImaging.ReleaseGdPictureImage(imageID);