Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, September 15, 2009 2:33:54 AM(UTC)
christo_1983

Groups: Registered
Posts: 13


     I have installed Lead tools 16.5 Version. In the sample examples given by lead tools in Dot Net Scanned image is in Raster Image Object. (e.image)

 I want to convert RasterImage Object to Byte Array. Kindly provide me code for how to convert RasterImage object to Byte Array.

 

 

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, September 15, 2009 4:46:22 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

If you want the image's pixel data copied into a byte array, you can do that using the RasterImage.GetRow Method to obtain the full image data in one function call. You can also copy part of the image if you specify a smaller size.

The full image size can be calculated as image.BytesPerLine * image.Height.

 
#3 Posted : Tuesday, September 15, 2009 10:52:24 PM(UTC)
christo_1983

Groups: Registered
Posts: 13


Thanks basel...

       Can you provide me some sample codes for how to use RasterImage.GetRow method

 
#4 Posted : Wednesday, September 16, 2009 11:20:37 PM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Please see the sample codes on this page:
http://www.leadtools.com/Help/LEADTOOLS/v16/DH/L/Leadtools~Leadtools.RasterImage~GetRow%28Int32,Byte%5B%5D,Int32,Int32%29.html

You can find this help topic "GetRow(Int32,Byte[],Int32,Int32) Method" in our .NET help file that is installed with the toolkit.

 
#5 Posted : Thursday, September 17, 2009 4:35:44 AM(UTC)
christo_1983

Groups: Registered
Posts: 13


     In the sample codes given in the above link Raster Image is converted into Two byte() and saved in a physical path. I want a single byte() and the image need not to be saved.

                 I want to convert a RasterImage object into Single byte() and insert into DataBase without physically saving the Image.

            Kindly provide me sample code for this Requirement.

  

 
#6 Posted : Thursday, September 17, 2009 5:49:08 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Do you want the byte array to contain a complete image of a certain format, such as JPEG, TIFF or BMP?
Or do you only want the raw pixel data without an image format header?

If you want it to contain raw data (pixel values) alone, the code to do it is one or 2 lines. You only call RasterImage.GetRow and you will immediately get a byte array full of pixel values.

If you want a complete image that can later load into a LEADTOOLS RasterImage object, you can use one of the RasterCodecs.Save() overloads that takes a memory stream as a destination for saving.
Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#7 Posted : Friday, September 18, 2009 10:33:50 PM(UTC)
christo_1983

Groups: Registered
Posts: 13


I want the byte array to contain a complete image of a certain format, such as JPEG or TIFF.

Is this possible without giving a physical path for saving the image and just filling the byte() object with the complete image, So that i can save the byte() into Database without physically saving.  

 
#8 Posted : Monday, September 21, 2009 12:26:11 PM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Yes, this is possible.  To do this you need to use the RasterCodecs.Save overloads that take a System.IO.Stream object rather than a string.  You can use a MemoryStream object for the destination with which you can then get a byte array.  For more details and an example, please see the .NET help file's documentation on the RasterCodecs.Save function.
 
#9 Posted : Tuesday, September 22, 2009 6:57:24 AM(UTC)
christo_1983

Groups: Registered
Posts: 13


Can u give me sample codes for RasterCodecs.Save function using Stream as parameter.

where is the .NET help file Documentation will be available ? kindly provide  me the path

I  am having Leadtools 16.5 installed in my machine.

 
#10 Posted : Thursday, September 24, 2009 3:51:14 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Here's how to use it:
RasterCodecs.Save(RasterImage,Stream,RasterImageFormat,Int32)

You can find a sample code in this page:
http://www.leadtools.com/Help/LEADTOOLS/v15/DH/CO/Leadtools.Codecs~Leadtools.Codecs.RasterCodecs~Save%28RasterImage,Stream,RasterImageFormat,Int32%29.html

About the .NET help file, it's available in the following directory:
[Program Files\LEAD Technologies\LEADTOOLS 16.5\Help\Dotnet]

 
#11 Posted : Friday, September 25, 2009 9:16:02 PM(UTC)
christo_1983

Groups: Registered
Posts: 13


In the above examples given in sample codes and in DotNet help file, Filestream object is used as parameter in Rastercodecs.Save function.

         Instead of that is there any source available with memory stream as parameter.So that physical saving of file can be avoided.

        kindly provide me source with memorystream as parameter in Rastercodecs.Save function.Memory stream variable should not be assigned with filename. 

  

 

 
#12 Posted : Sunday, September 27, 2009 5:46:21 AM(UTC)

Basel  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Christo,
Our RasterCodecs.Save method works with both file and memory streams. Did you try it?
 
#13 Posted : Tuesday, September 29, 2009 7:22:33 AM(UTC)
Jordan_S

Groups: Registered
Posts: 7


System.IO.MemoryStream imagestream = new System.IO.MemoryStream();
_codecs.Save(_image, imagestream, 0, RasterImageFormat.TifJpeg, 8, 1, _image.PageCount, 1, CodecsSavePageMode.Insert);
byte[] bytes = imagestream.ToArray();

Try something like that.
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.204 seconds.