←Select platform

Name Property

Summary
Indicates the optional name of the file to use as a hint when loading image data from memory streams.
Syntax
C#
Objective-C
C++/CLI
Python
public string Name { get; set; } 
@property (nonatomic, copy, nullable) NSString *name; 
public: 
property String^ Name { 
   String^ get(); 
   void set (    String^ ); 
} 
Name # get and set (CodecsLoadOptions) 

Property Value

The optional name of file to load. Default value is null.

Remarks

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

Target Platforms

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

Leadtools.Codecs Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.