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 : Monday, October 31, 2011 3:45:06 AM(UTC)
xdepalol

Groups: Registered
Posts: 8


I'm using .Net 40 and LeadTools Imaging Pro 17.5 in a Web project.

I have a problem when loading images from a Stream. When I load an image using a FileStream it works fine but it fails when loaded from a standard Stream (System.IO.Stream).

For my solution I cannot use a FileStream, since I get the file from an external resource by means of a stream. For the sake of simplicity, I can reproduce the problem if I read a file into a FileStream and then copy it to a MemoryStream.

The following lines shows the details of my code:

FileStream f = File.Open("anyfoto.jpg", FileMode.Open);
MemoryStream myfs = new MemoryStream();
f.CopyTo(myfs);
LeadtoolsSupport.SetLicense();
RasterCodecs codecs = new RasterCodecs();
RasterImage srcImage = codecs.Load(myfs);

At the "codecs.Load" point it raises a System.NotSupportedException:

Stack: [NotSupportedException: Esta secuencia no es compatible con operaciones de búsqueda.]
System.Net.ConnectStream.get_Position() +57
Leadtools.Codecs.RasterCodecs.DoLoad(LoadParams loadParams) +202
Leadtools.Codecs.RasterCodecs.Load(Stream stream) +116

Am I doing something wrong? Any help would be appreciated.

Best regards, Xavier.
 

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 : Monday, October 31, 2011 4:13:52 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

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

Try to call MemoryStream.Seek method before loading the image as follows:
+-------------+
FileStream f = File.Open("anyfoto.jpg", FileMode.Open);
MemoryStream myfs = new MemoryStream();
f.CopyTo(myfs);
LeadtoolsSupport.SetLicense();
RasterCodecs codecs = new RasterCodecs();

myfs.Seek(0, System.IO.SeekOrigin.Begin);

RasterImage srcImage = codecs.Load(myfs);
+-------------+
If the problem persists, please create a small working project (not your full application) that shows the problem and send it in a new email to support@leadtools.com and mention this forum post in your email.

Note: If you send sample files or any attachments, please put them in a ZIP or RAR file to ensure our server delivers them correctly.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Monday, October 31, 2011 6:17:42 AM(UTC)
xdepalol

Groups: Registered
Posts: 8


It worked. The seek sentence made the difference.

Thank you,
Xavier.
 
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.169 seconds.