To load an image from a Stream
object, use the CreateGdPictureImageFromStream
method from the GdPictureImaging
class. The provided stream object must support seeking. The CreateGdPictureImageFromStream
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 accepts the following parameters:
-
Stream
— The image data stored in a stream object. -
ImageFormat
— Optional: Specifies the image format represented as a member of theDocumentFormat
enumeration. -
DirectAccess
— Optional: When this parameter is set totrue
, then only the image properties, metadata, and embedded thumbnail are loaded. This parameter requires theImageFormat
.
Remember to release the image resource once you stop using it. Use the
ReleaseGdPictureImage
method.
To load an image from a byte array, use the following code:
using GdPictureImaging gdpictureImaging = new GdPictureImaging(); // Create a stream object from an image file. using Stream streamImage = new FileStream(@"C:\temp\source.jpg", FileMode.Open); // Create a GdPicture image from the stream object. int imageID = gdpictureImaging.CreateGdPictureImageFromStream(streamImage); gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png"); gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging() ' Create a stream object from an image file. Dim streamImage As Stream = New FileStream("C:\temp\source.jpg", FileMode.Open) ' Create a GdPicture image from the stream object. Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromStream(streamImage) gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png") gdpictureImaging.ReleaseGdPictureImage(imageID) End Using
To load a bitmap image from a Stream
object, use the CreateGdPictureImageFromStream
method from the GdPictureImaging
class. The provided stream object must support seeking. The CreateGdPictureImageFromStream
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 accepts the following parameters:
-
Stream
— The image data stored in a stream object. -
ImageFormat
— Optional: Specifies the image format represented as a member of theDocumentFormat
enumeration. -
DirectAccess
— Optional: When this parameter is set totrue
, then only the image properties, metadata, and embedded thumbnail are loaded. This parameter requires theImageFormat
.
Remember to release the image resource once you stop using it. Use the
ReleaseGdPictureImage
method.
To load a bitmap image from a byte array, use the following code:
using GdPictureImaging gdpictureImaging = new GdPictureImaging(); // Create a stream object from an image file. using Stream streamImage = new FileStream(@"C:\temp\source.bmp", FileMode.Open); // Create a GdPicture image from the stream object. int imageID = gdpictureImaging.CreateGdPictureImageFromStream(streamImage); gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png"); gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging() ' Create a stream object from an image file. Dim streamImage As Stream = New FileStream("C:\temp\source.bmp", FileMode.Open) ' Create a GdPicture image from the stream object. Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromStream(streamImage) gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png") gdpictureImaging.ReleaseGdPictureImage(imageID) End Using
To load an SVG image from a Stream
object, use the CreateGdPictureImageFromStream
method from the GdPictureImaging
class. The provided stream object must support seeking. The CreateGdPictureImageFromStream
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 accepts the following parameters:
-
Stream
— The image data stored in a stream object. -
ImageFormat
— Optional: Specifies the image format represented as a member of theDocumentFormat
enumeration. -
DirectAccess
— Optional: When this parameter is set totrue
, then only the image properties, metadata, and embedded thumbnail are loaded. This parameter requires theImageFormat
.
Remember to release the image resource once you stop using it. Use the
ReleaseGdPictureImage
method.
To load an SVG image from a byte array, use the following code:
using GdPictureImaging gdpictureImaging = new GdPictureImaging(); // Create a stream object from an image file. using Stream streamImage = new FileStream(@"C:\temp\source.svg", FileMode.Open); // Create a GdPicture image from the stream object. int imageID = gdpictureImaging.CreateGdPictureImageFromStream(streamImage); gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png"); gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging() ' Create a stream object from an image file. Dim streamImage As Stream = New FileStream("C:\temp\source.svg", FileMode.Open) ' Create a GdPicture image from the stream object. Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromStream(streamImage) gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png") gdpictureImaging.ReleaseGdPictureImage(imageID) End Using
To load a DICOM image from a Stream
object, use the CreateGdPictureImageFromStream
method from the GdPictureImaging
class. The provided stream object must support seeking. The CreateGdPictureImageFromStream
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 accepts the following parameters:
-
Stream
— The image data stored in a stream object. -
ImageFormat
— Optional: Specifies the image format represented as a member of theDocumentFormat
enumeration. -
DirectAccess
— Optional: When this parameter is set totrue
, then only the image properties, metadata, and embedded thumbnail are loaded. This parameter requires theImageFormat
.
Remember to release the image resource once you stop using it. Use the
ReleaseGdPictureImage
method.
To load a DICOM image from a byte array, use the following code:
using GdPictureImaging gdpictureImaging = new GdPictureImaging(); // Create a stream object from an image file. using Stream streamImage = new FileStream(@"C:\temp\source.dcm", FileMode.Open); // Create a GdPicture image from the stream object. int imageID = gdpictureImaging.CreateGdPictureImageFromStream(streamImage); gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png"); gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging() ' Create a stream object from an image file. Dim streamImage As Stream = New FileStream("C:\temp\source.dcm", FileMode.Open) ' Create a GdPicture image from the stream object. Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromStream(streamImage) gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png") gdpictureImaging.ReleaseGdPictureImage(imageID) End Using
To load a TIFF image from a Stream
object, use the CreateGdPictureImageFromStream
method from the GdPictureImaging
class. The provided stream object must support seeking. The CreateGdPictureImageFromStream
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 accepts the following parameters:
-
Stream
— The image data stored in a stream object. -
ImageFormat
— Optional: Specifies the image format represented as a member of theDocumentFormat
enumeration. -
DirectAccess
— Optional: When this parameter is set totrue
, then only the image properties, metadata, and embedded thumbnail are loaded. This parameter requires theImageFormat
.
Remember to release the image resource once you stop using it. Use the
ReleaseGdPictureImage
method.
To load a TIFF image from a byte array, use the following code:
using GdPictureImaging gdpictureImaging = new GdPictureImaging(); // Create a stream object from an image file. using Stream streamImage = new FileStream(@"C:\temp\source.tif", FileMode.Open); // Create a GdPicture image from the stream object. int imageID = gdpictureImaging.CreateGdPictureImageFromStream(streamImage); gdpictureImaging.SaveAsPNG(imageID, @"C:\temp\output.png"); gdpictureImaging.ReleaseGdPictureImage(imageID);
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging() ' Create a stream object from an image file. Dim streamImage As Stream = New FileStream("C:\temp\source.tif", FileMode.Open) ' Create a GdPicture image from the stream object. Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromStream(streamImage) gdpictureImaging.SaveAsPNG(imageID, "C:\temp\output.png") gdpictureImaging.ReleaseGdPictureImage(imageID) End Using