←Select platform

Name Property


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 
property String^ Name { 
   String^ get(); 
   void set (    String^ ); 

Property Value

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); 


Target Platforms

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly