Load a Bitmap (BMP) from a Remote URL in C#

To load an image from a remote URL, use the CreateGdPictureImageFromHTTP method from the GdPictureImaging class. This method creates a new GdPicture representation of an image and returns a unique non-zero image identifier — imageID — of the newly created GdPicture image. This method requires two different sets of parameters depending on the type of server:

Loading an Image from a Public Server

When the server you want to get the image from is public, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Host — Server host name where the image is located.

  • Path — Image file path on the host server.

  • HTTPPort — Server port number.

Warning

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

Information

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.

To load an image from a public server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from an image on a public server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
    "downloads/load-a-file/source.jpg", 443);
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using  gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from an image on a public server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
        "downloads/load-a-file/source.jpg", 443)
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

Loading an Image from a Protected Server

When the server you want to get the image from is private, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Uri — Full path to an image.

  • Login — Login used to authenticate the connection on the server.

  • Password — Password required to authenticate the connection on the server.

Warning

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

Information

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.

To load an image from a protected server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from an image on a protected server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.jpg",
    "admin", "password");
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from an image on a protected server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.jpg",
        "admin", "password")
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

To load a bitmap image from a remote URL, use the CreateGdPictureImageFromHTTP method from the GdPictureImaging class. This method creates a new GdPicture representation of an image and returns a unique non-zero image identifier — imageID — of the newly created GdPicture image. This method requires two different sets of parameters depending on the type of server:

Loading a Bitmap Image from a Public Server

When the server you want to get the image from is public, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Host — Server host name where the image is located.

  • Path — Image file path on the host server.

  • HTTPPort — Server port number.

Warning

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

Information

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.

To load a bitmap image from a public server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from a bitmap image on a public server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
    "downloads/load-a-file/source.bmp", 443);
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using  gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from a bitmap image on a public server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
        "downloads/load-a-file/source.bmp", 443)
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

Loading a Bitmap Image from a Protected Server

When the server you want to get the image from is private, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Uri — Full path to a bitmap image.

  • Login — Login used to authenticate the connection on the server.

  • Password — Password required to authenticate the connection on the server.

Warning

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

Information

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.

To load a bitmap image from a protected server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from a bitmap image on a protected server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.bmp",
    "admin", "password");
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from a bitmap image on a protected server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.bmp",
        "admin", "password")
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

To load an SVG image from a remote URL, use the CreateGdPictureImageFromHTTP method from the GdPictureImaging class. This method creates a new GdPicture representation of an image and returns a unique non-zero image identifier — imageID — of the newly created GdPicture image. This method requires two different sets of parameters depending on the type of server:

Loading an SVG Image from a Public Server

When the server you want to get the image from is public, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Host — Server host name where the image is located.

  • Path — Image file path on the host server.

  • HTTPPort — Server port number.

Warning

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

Information

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.

To load an SVG image from a public server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from an SVG image on a public server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
    "downloads/load-a-file/source.svg", 443);
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using  gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from an SVG image on a public server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
        "downloads/load-a-file/source.svg", 443)
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

Loading an SVG Image from a Protected Server

When the server you want to get the image from is private, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Uri — Full path to an SVG image.

  • Login — Login used to authenticate the connection on the server.

  • Password — Password required to authenticate the connection on the server.

Warning

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

Information

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.

To load an SVG image from a protected server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from an SVG image on a protected server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.svg",
    "admin", "password");
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from an SVG image on a protected server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.svg",
        "admin", "password")
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

To load a DICOM image from a remote URL, use the CreateGdPictureImageFromHTTP method from the GdPictureImaging class. This method creates a new GdPicture representation of an image and returns a unique non-zero image identifier — imageID — of the newly created GdPicture image. This method requires two different sets of parameters depending on the type of server:

Loading a DICOM Image from a Public Server

When the server you want to get the image from is public, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Host — Server host name where the image is located.

  • Path — Image file path on the host server.

  • HTTPPort — Server port number.

Warning

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

Information

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.

To load a DICOM image from a public server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from a DICOM image on a public server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
    "downloads/load-a-file/source.dcm", 443);
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using  gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from a DICOM image on a public server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
        "downloads/load-a-file/source.dcm", 443)
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

Loading a DICOM Image from a Protected Server

When the server you want to get the image from is private, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Uri — Full path to a DICOM image.

  • Login — Login used to authenticate the connection on the server.

  • Password — Password required to authenticate the connection on the server.

Warning

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

Information

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.

To load a DICOM image from a protected server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from a DICOM image on a protected server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.dcm",
    "admin", "password");
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from a DICOM image on a protected server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.dcm",
        "admin", "password")
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

To load a TIFF image from a remote URL, use the CreateGdPictureImageFromHTTP method from the GdPictureImaging class. This method creates a new GdPicture representation of an image and returns a unique non-zero image identifier — imageID — of the newly created GdPicture image. This method requires two different sets of parameters depending on the type of server:

Loading a TIFF Image from a Public Server

When the server you want to get the image from is public, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Host — Server host name where the image is located.

  • Path — Image file path on the host server.

  • HTTPPort — Server port number.

Warning

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

Information

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.

To load a TIFF image from a public server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from a TIFF image on a public server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
    "downloads/load-a-file/source.tif", 443);
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using  gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from a TIFF image on a public server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com",
        "downloads/load-a-file/source.tif", 443)
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using

Loading a TIFF Image from a Protected Server

When the server you want to get the image from is private, then the CreateGdPictureImageFromHTTP method requires the following parameters:

  • Uri — Full path to a TIFF image.

  • Login — Login used to authenticate the connection on the server.

  • Password — Password required to authenticate the connection on the server.

Warning

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

Information

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.

To load a TIFF image from a protected server, use the following code:

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Create a GdPicture image from a TIFF image on a protected server.
int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.tif",
    "admin", "password");
// Save to a PNG image.
gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Create a GdPicture image from a TIFF image on a protected server.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromHTTP("https://pspdfkit.com/downloads/load-a-file/source.tif",
        "admin", "password")
    ' Save to a PNG image.
    gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using