- (BOOL)feedLoad:(const unsigned char *)buffer length:(NSUInteger)length error:(NSError **)error- (BOOL)feedLoadData:(NSData *)data length:(NSUInteger)length error:(NSError **)error
data
The image file unmanaged memory data.
length
Total size (in bytes) of the image data.
Use this method with the StartFeedLoad and StopFeedLoad methods.
For a description of how the methods relate to each other, refer to StartFeedLoad.
LEADTOOLS will attempt to load corrupted files so you can see at least a portion of the image. For these images, the load methods succeed, but LoadStatus will return an error code.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;public void FeedLoadExample(){RasterCodecs codecs = new RasterCodecs();codecs.CancelFeedLoad();string url = @"https://www.leadtools.com/images/page_graphics/leadlogo.png";string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "FeedLoad.bmp");// Create a WebRequest for the URLWebRequest request = WebRequest.Create(url);request.Proxy.Credentials = CredentialCache.DefaultCredentials;// reduce the timeout to 20secrequest.Timeout = 20000;WebResponse response = request.GetResponse();try{Stream strm = response.GetResponseStream();// Read chunks from the stream and feed load to the imagecodecs.StartFeedLoad(0, CodecsLoadByteOrder.BgrOrGray);const int bufferSize = 1024;byte[] buffer = new byte[bufferSize];int read;do{System.Windows.Forms.Application.DoEvents();read = strm.Read(buffer, 0, bufferSize);Debug.WriteLine("Downloading {0} bytes", read);if (read > 0)codecs.FeedLoad(buffer, 0, read);}while (read > 0);}finally{response.Close();}RasterImage image = codecs.StopFeedLoad();// Save the image to diskcodecs.Save(image, destFileName, RasterImageFormat.Bmp, 24);image.Dispose();// Clean upcodecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
