LEADTOOLS Support
General
LEADTOOLS SDK Examples
Byte Array to IO.MemoryStream ... IO.MemoryStream to RasterImage
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, August 8, 2006 3:07:20 AM(UTC)
Groups: Registered
Posts: 2
Hi, an example showing how to take an array of byte
and save it to a IO.MemoryStream and then use this stream to create the RasterImage object,
all this without passing through an intermediate Image object would
help me A LOT :) ....
thankx....
#2
Posted
:
Tuesday, August 8, 2006 3:09:35 AM(UTC)
Groups: Registered
Posts: 2
In VB.Net would be even nicer ;)
#3
Posted
:
Wednesday, August 9, 2006 3:46:22 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
If the byte array contains a complete image file (including headers), you can use the following code:
+--------------------------+
...
Dim MyImage As IRasterImage
fs.Read(byte1, 0, fs.Length)
' bytes and an array of type byte
Dim ms As MemoryStream
ms = New MemoryStream
ms.Write(byte1, 0, byte1.Length)
ms.Seek(0, SeekOrigin.Begin)
MyImage = codecs.Load(ms, 0, ms.Length)
...
+--------------------------+
If the array contains only image pixel data (raw image), you also use the Load method, but you will need to specify the raw format using the _codecs.Options.Load.Format property, and handle the _codecs.LoadInformation event. This is explained in the help file and shown in the main VB.NET demo.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
LEADTOOLS Support
General
LEADTOOLS SDK Examples
Byte Array to IO.MemoryStream ... IO.MemoryStream to RasterImage
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.