Indicates the optional name of the file to use as a hint when loading image data from memory streams.
public string Name { get; set; }
Public Property Name As String
The optional name of file to load. Default value is null.
Some file formats do not contain a well-defined file signature. This is especially true for document file formats (TXT, PST, etc.). LEADTOOLS can still detect the file format using the filename extension (ex. ".txt" or ".pst"). However, when loading files from memory streams (or if the extension of file on disk differs from the common one), the filename extension is not available. You can use this property to provide the RasterCodecs class with this information to use as a hint when loading the image data.
The value does not have to be the original file name, it can be any generic value such as "file.txt", RasterCodecs will then use the extension (in this case, .txt) as a hint if it cannot determine the file format from the data itself.
The value is not used and is ignored if the data contains image data with a well-defined file signature, such as TIFF, JPEG or PDF.
When loading a file from an HTTP stream, the MIME type is always available and the value can be passed to RasterCodecs.GetExtensionMimeType to obtain the extension to be used with Name. For example:
RasterCodecs rasterCodecs = new RasterCodecs();
WebRequest request = WebRequest.Create("http://myserver/mydata");
using (WebResponse response = request.GetResponse())
{
// Get the content type (MIME type)
string mimeType1 = request.ContentType;
// Get the corresponding file extension
String extension = RasterCodecs.GetMimeTypeExtension(mimeType);
// Use it as a hint to RasterCodecs when loading this image file
rasterCodecs.Options.Load.Name = "file." + extension;
// Now load the image from the stream
Stream stream = response.GetResponseStream();
rasterCodecs.Load(stream, 1);
}
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