This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/load-a-file/imaging/from-remote-url-image.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Load an image from a remote URL in C# .NET | Nutrient .NET SDK
Image

To load an image from a remote URL, use the CreateGdPictureImageFromHTTP method from the GdPictureImaging class.

This method returns a non-zero image identifier (imageID) on success. If it fails, it returns 0 — use GetStat() and GetLastTransferError() to diagnose the failure.

CreateGdPictureImageFromHTTP has two common usage patterns:

When transferring data to or from remote servers, you can optionally use the SetHttpTransferBufferSize method to specify the maximum package size of the transferred data. By default, the buffer size is 4096.

Loading an image from a public server

Use this overload: CreateGdPictureImageFromHTTP(string Host, string Path, int HTTPPort).

Parameters:

  • Host — Server host (can include scheme).
  • Path — Image path on the host.
  • HTTPPort — Port number (for example 80 or 443).

Remember to release the image resource once you stop using it. Use the ReleaseGdPictureImage method.

using GdPicture14;
using System;
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP(
"https://pspdfkit.com",
"/downloads/load-a-file/source.jpg",
443);
if (imageID == 0)
{
Console.WriteLine($"HTTP load failed: {gdpictureImaging.GetStat()}");
Console.WriteLine($"Transfer error: {gdpictureImaging.GetLastTransferError()}");
return;
}
GdPictureStatus status = gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAsPNG failed: {status}");
}
gdpictureImaging.ReleaseGdPictureImage(imageID);

Loading an image from a protected server

Use this overload: CreateGdPictureImageFromHTTP(string Uri, string Login, string Password).

Parameters:

  • Uri — Full image URL.
  • Login — Username for authentication.
  • Password — Password for authentication.

Remember to release the image resource once you stop using it. Use the ReleaseGdPictureImage method.

using GdPicture14;
using System;
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP(
"https://pspdfkit.com/downloads/load-a-file/source.jpg",
"admin",
"password");
if (imageID == 0)
{
Console.WriteLine($"HTTP load failed: {gdpictureImaging.GetStat()}");
Console.WriteLine($"Transfer error: {gdpictureImaging.GetLastTransferError()}");
return;
}
GdPictureStatus status = gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
if (status != GdPictureStatus.OK)
{
Console.WriteLine($"SaveAsPNG failed: {status}");
}
gdpictureImaging.ReleaseGdPictureImage(imageID);